GCCollectionMode Enumeration


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Specifies the behavior for a forced garbage collection.

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

public enum class GCCollectionMode

Member nameDescription

The default setting for this enumeration, which is currently Forced.


Forces the garbage collection to occur immediately.


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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top