且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#中获取列表中新添加项的索引?

更新时间:2023-10-02 16:52:58

MapTiles.Count 将为您提供将添加到列表中的下一项的索引

MapTiles.Count will give you the index of next item that will be added to the list

类似于:

Console.WriteLine("Adding " + MapTiles.Count + "th item to MapTiles List");
MapTiles.Add(new Class1(num, x * 32 + cameraX, y * 32 + cameraY));