Changes

Jump to: navigation, search

C Sharp List and ArrayList Collections

565 bytes added, 16:37, 23 January 2008
Removing Items From Lists
It is important to note that items in a list may be duplicated. In the case of duplicated items, the Remove() method will only remove the first matching instance.
 
== Inserting Items into a C# List ==
 
Previously we used the ''Add()'' method to add items to a list. The ''Add()'' method, however, only adds items to the end of a list. Sometimes it is necessary to insert a new item at a specific location in a list. The ''Insert()'' method is provided for this specific purpose. ''Insert()'' takes two arguments, an integer indicating the index location of the insertion and the item to be inserted at that location. For example, to insert an item at location 2 in our example list:
 
<pre>
colorList.Insert(2, "White");
</pre>
== Sorting Lists in C# ==

Navigation menu