[Reserved] Method C # Add to the List object is set corresponding elements added at the end

List C # in the set operation, and sometimes need to be eligible subjects prior to the end of the set of List, then you need to use a set of List Add method, the role of the Add method is added to the corresponding elements of List end of the collection, Add method signature void Add (T item), type T represents the List collection of specific elements are C # generics syntax elements of the object on behalf of a specific item to be added.

For example, list1 contains a set of List elements 1 to 10, this time need to be added to the collection list1 element 11 with the following statement:

List<int> list1 = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
list1.Add(11);

List elements of the collection for the system comes from the use of a reference type or types defined in the same situation.

 

Note: The text reproduced from personal bloggers station IT technology small fun house , the original link in C # Add method to add a List collection at the end of the corresponding elements of the object _IT technology small fun house .

Guess you like

Origin www.cnblogs.com/xu-yi/p/11026506.html