GCCollectionMode Enumeration
TOC
Collapse the table of content
Expand the table of content

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)

'Declaration
Public Enumeration GCCollectionMode

Member nameDescription
DefaultThe default setting for this enumeration, which is currently Forced.
ForcedForces the garbage collection to occur immediately.
OptimizedAllows 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.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft