System.Collections.Generic.List

Added in .NET 2.0
Represents a collection of objects that can be individually accessed by an index
Appending elements is fast but inserting elements at a given position is slow
Searching using binary search is fast if the list has already been sorted.
This type of collection represents a collection on keys and values
provides access by index numbers


System.Collections.Generic.List 

Fixed Size

Allows modification of elements but does not allow the addition or removal of elements.

myList = new System.Collections.Generic.List<string>(3); 
myList.Add("one");
myList.Add("two");
myList.Add("three");
System.Diagnostics.Debug.Print System.String.Format("Count={0}", myList.Count)

System.Diagnostics.Debug.Print myList[2];





Variable Size

Allows addition, removal and modification of elements.



Where



GenericList.Add = how to check of its already been added ? 


Distinct


GenericList.Distinct.ToList 


ToArray

copy the list to an array


get a value at a given index
get a subrange/sublist between 2 index positions


reverse the order of the items


get an enumerator for the list





© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext