Collect Method

GC.Collect Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Induces garbage collection.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method Static member Collect() Induces an immediate garbage collection of all generations.
Public method Static member Collect(Int32) Security Critical. Induces an immediate garbage collection of a specified generation.
Public method Static member Collect(Int32, GCCollectionMode) Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value.
Public method Static member Collect(Int32, GCCollectionMode, Boolean) Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value, with a value specifying whether the collection should be blocking.
Top

Show:
© 2017 Microsoft