TableRowCollection.TrimToSize Method


通过将基础集合 Capacity 设置为等于集合中当前项的 Count 来优化集合的内存占用。Optimizes memory consumption for the collection by setting the underlying collection Capacity equal to the Count of items currently in the collection.

 void TrimToSize();
public void TrimToSize ();
member this.TrimToSize : unit -> unit
Public Sub TrimToSize ()


此方法可用于最大程度地减少集合的内存开销,尤其是在集合包含的项集应为静态的情况下。This method can be used to minimize memory overhead for a collection, particularly if the set of items contained by the collection is expected to be static.

Applies to