Mono Class Library: System.Collections.Generic.List<T> Overview | Members

System.Collections.Generic.List<T>.TrimExcess Method

Suggests that the capacity be reduced to the actual number of elements in the list.

public void TrimExcess ()

Remarks

This method can be used to suggest a collection's memory overhead be minimized, e.g., if no new elements are expected to be added to the collection.

Note: To reset a list to its initial state, call the List.Clear method before calling List.TrimExcess.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0