且构网

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

添加到数组方法?

更新时间:2023-12-02 23:49:10





Hi,

z3ngew写道:

z3ngew wrote:

就像添加时一样列出



那么,为什么你不使用列表

你可以转换一个列表使用 ToArray 方法到一个数组,你可以创建一个列表来自使用此代码的数组的code>:


So, why you don''t use a List?
You can convert a List to an array using the ToArray method, and you can create a List from an array using this code:

List<int> integerList = new List<int>(integerArray); // create a List from an array
// alternative way: List<int> integerList = integerArray.ToList();
// add some integers
integerArray = integerList.ToArray();



希望这有帮助。


Hope this helps.


这个帖子可以帮到你,



http ://***.com/questions/249452/add-new-item-in-existing-array-in-c-net [ ^ ]
This thread should help you,

http://***.com/questions/249452/add-new-item-in-existing-array-in-c-net[^]


Array.SetValue (对象值,int索引);
Array.SetValue(object value, int index);