List <T> collection

1.List What is?

You can store different types and variable length data set. On the memory is placed in a row can be accessed with an index coordinates. Generic: data type to ensure safety and avoid boxing and unboxing operation.
Array type

2. Usage

List<int> list = new List<int>() { 1, 2, 3 };
list.Add(456);
list.Add(789);

list.Clear();//清空集合中所有元素

list.Remove(456);//根据指定对象进行移除
list.RemoveAt(0);//根据索引坐标进行移除

Guess you like

Origin www.cnblogs.com/songbuqi/p/12663352.html