mscorlib 2.0.0.0 4.0.0.0 System.ValueType System.Collections.Generic.IEnumerator<T>

The class is the generic equivalent of the class. It implements the generic interface by using an array whose size is dynamically increased as required.

You can add items to a by using the or methods.

The class uses both an equality comparer and an ordering comparer.

Methods such as , , , and use an equality comparer for the list elements. The default equality comparer for type is determined as follows. If type implements the generic interface, then the equality comparer is the method of that interface; otherwise, the default equality comparer is .

Methods such as and use an ordering comparer for the list elements. The default comparer for type is determined as follows. If type implements the generic interface, then the default comparer is the method of that interface; otherwise, if type implements the nongeneric interface, then the default comparer is the method of that interface. If type implements neither interface, then there is no default comparer, and a comparer or comparison delegate must be provided explicitly.

The is not guaranteed to be sorted. You must sort the before performing operations (such as ) that require the to be sorted.

Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.

For very large objects, you can increase the maximum capacity to 2 billion elements on a 64-bit system by setting the enabled attribute of the gcAllowVeryLargeObjects configuration element to true in the run-time environment.

accepts null as a valid value for reference types and allows duplicate elements.

For an immutable version of the class, see .

## Performance Considerations

In deciding whether to use the or class, both of which have similar functionality, remember that the class performs better in most cases and is type safe. If a reference type is used for type of the class, the behavior of the two classes is identical. However, if a value type is used for type , you need to consider implementation and boxing issues.

If a value type is used for type , the compiler generates an implementation of the class specifically for that value type. That means a list element of a object does not have to be boxed before the element can be used, and after about 500 list elements are created the memory saved not boxing list elements is greater than the memory used to generate the class implementation.

Make certain the value type used for type implements the generic interface. If not, methods such as must call the method, which boxes the affected list element. If the value type implements the interface and you own the source code, also implement the generic interface to prevent the and methods from boxing list elements. If you do not own the source code, pass an object to the and methods

It is to your advantage to use the type-specific implementation of the class instead of using the class or writing a strongly typed wrapper collection yourself. The reason is your implementation must do what the .NET Framework does for you already, and the common language runtime can share Microsoft intermediate language code and metadata, which your implementation cannot.

Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.

- Property
  2.0.0.0
  4.0.0.0
  T To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Object To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.