System.Collections.Generic.List<T> Members

The members of System.Collections.Generic.List<T> are listed below.

See Also: Inherited members from System.Object

Public Constructors

Initializes a new list that is empty and has the default initial capacity.
Initializes a new list with elements copied from the specified collection, ensuring that the list has sufficient capacity to accommodate the number of elements copied.
Initializes a new list that is empty and has the specified initial capacity.

Public Properties

Capacityint. Gets or sets the number of elements the current instance can contain.
[read-only]
Countint. Gets the number of elements contained in the current instance.
default property
Item(int)T. Gets or sets the element at the specified index of the current instance.

Public Methods

Add(T)
Adds an item to the end of the list.
AddRange(IEnumerable<T>)
Adds the elements of the specified collection to the end of the list.
AsReadOnly() : System.Collections.ObjectModel.ReadOnlyCollection<T>
Returns a read-only wrapper to the current List.
BinarySearch(T) : int
Searches the entire sorted list for an element using the default comparer, and returns the zero-based index of the element.
BinarySearch(T, IComparer<T>) : int
Searches the entire sorted list for an element using the specified comparer and returns the zero-based index of the element.
BinarySearch(int, int, T, IComparer<T>) : int
Searches a range of elements in the sorted list for an element using the specified comparer and returns the zero-based index of the element.
Clear()
Removes all elements from the list.
Contains(T) : bool
Determines whether the list contains a specific value.
ConvertAll<TOutput>(Converter<T, TOutput>) : List<TOutput>
Documentation for this section has not yet been entered.
CopyTo(T[])
Copies the entire list to an array.
CopyTo(T[], int)
Copies the elements of the list to an array, starting at a particular index.
CopyTo(int, T[], int, int)
Copies a range of elements of the list to an array, starting at a particular index in the target array.
Exists(Predicate<T>) : bool
Determines whether the List contains elements that match the conditions defined by the specified predicate.
Find(Predicate<T>) : T
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.
FindAll(Predicate<T>) : List<T>
Retrieves all the elements that match the conditions defined by the specified predicate.
FindIndex(Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the List.
FindIndex(int, Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the List that extends from the specified index to the last element.
FindIndex(int, int, Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the List that starts at the specified index and contains the specified number of elements.
FindLast(Predicate<T>) : T
Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire List.
FindLastIndex(Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the List.
FindLastIndex(int, Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the List that extends from the specified index to the first element.
FindLastIndex(int, int, Predicate<T>) : int
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the List that starts at the specified index and contains the specified number of elements going backwards.
ForEach(Action<T>)
Performs the specified action on each element of the List.
GetEnumerator() : List<T>.Enumerator
Returns an enumerator, in index order, that can be used to iterate over the list.
GetRange(int, int) : List<T>
Creates a shallow copy of a range of elements in the current List.
IndexOf(T) : int
Searches for the specified object and returns the zero-based index of the first occurrence within the entire list.
IndexOf(T, int) : int
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that extends from the specified index to the last element.
IndexOf(T, int, int) : int
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.
Insert(int, T)
Inserts an item to the List at the specified position.
InsertRange(int, IEnumerable<T>)
Inserts the elements of a collection in the List at the specified position.
LastIndexOf(T) : int
Searches for the specified object and returns the zero-based index of the last occurrence within the entire list.
LastIndexOf(T, int) : int
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the list that extends from the specified index to the last element.
LastIndexOf(T, int, int) : int
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.
Remove(T) : bool
Removes the first occurrence of the specified object from the list.
RemoveAll(Predicate<T>) : int
Removes the all the elements that match the conditions defined by the specified predicate.
RemoveAt(int)
Removes the item at the specified index of the list.
RemoveRange(int, int)
Removes a range of elements from the list.
Reverse()
Reverses the order of the elements in the list.
Reverse(int, int)
Reverses the order of the elements in the specified element range of the list.
Sort()
Sorts the elements in the list using the default comparer.
Sort(IComparer<T>)
Sorts the elements in the list using the specified comparer.
Sort(Comparison<T>)
Sorts the elements in the list using the specified comparison.
Sort(int, int, IComparer<T>)
Sorts the elements in the list using the specified comparer.
ToArray() : T[]
Copies the elements in the list to a new array.
TrimExcess()
Suggests that the capacity be reduced to the actual number of elements in the list.
TrueForAll(Predicate<T>) : bool
Determines whether every element in the List matches the conditions defined by the specified predicate.

Explicitly Implemented Interface Members

IList.AddThis method is implemented to support the IList interface.
IList.ContainsThis method is implemented to support the IList interface.
ICollection.CopyToThis method is implemented to support the ICollection interface.
IEnumerable<T>.GetEnumeratorThis method is implemented to support the IEnumerable<T> interface.
IEnumerable.GetEnumeratorThis method is implemented to support the IEnumerable interface.
IList.IndexOfThis method is implemented to support the IList interface.
IList.InsertThis method is implemented to support the IList interface.
[read-only]
IList.IsFixedSizebool. This read-only property is implemented to support the IList interface.
[read-only]
ICollection<T>.IsReadOnlybool.

This read-only property is implemented to support the ICollection<T> interface.

Note:

For more information, see ICollection<T>.IsReadOnly.

[read-only]
IList.IsReadOnlybool. This read-only property is implemented to support the IList interface.
[read-only]
ICollection.IsSynchronizedbool. This read-only property is implemented to support the ICollection interface.
IList.Itemobject. This read-only property is implemented to support the IList interface.
IList.RemoveThis method is implemented to support the IList interface.
[read-only]
ICollection.SyncRootobject. This read-only property is implemented to support the ICollection interface.