GC.MaxGeneration Property

Gets the maximum number of generations that the system currently supports.

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

public static int MaxGeneration { get; }

Property Value

Type: System.Int32
A value that ranges from zero to the maximum number of supported generations.

The generation number, or age, of an object is an implementation-defined relative measure of an object's lifespan. The most recently created objects are in generation zero and the oldest objects are in a generation less than or equal to the generation returned by the MaxGeneration property.

The garbage collector assumes that newer memory is more likely to be eligible for garbage collection than older memory. Therefore, the garbage collector improves its performance by adjusting generation numbers each time it reclaims memory, and the MaxGeneration property value can grow over time.

If object aging is implemented, the MaxGeneration property returns the maximum generation number used by the system; otherwise, this property returns zero.

Notes to Implementers

For this implementation, the value returned by the MaxGeneration property is guaranteed to remain constant for the lifetime of an executing application.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions