GCCollectionMode Enumeration

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

Specifies the behavior for a forced garbage collection.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)


Public Enumeration GCCollectionMode
public enum GCCollectionMode


Member name Description
Default The default setting for this enumeration, which is currently Forced.
Forced Forces the garbage collection to occur immediately.
Optimized Allows the garbage collector to determine whether the current time is optimal to reclaim objects.


Use the GC..::.Collect method overload to specify the GCCollectionMode value.


The following example forces a garbage collection for generation 2 objects with the Optimized setting.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also


System Namespace