System.GC.MaxGeneration Property

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


public static Int32 MaxGeneration { get; }


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 0 and the oldest objects are in a generation less than or equal to the generation returned by the GC.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 GC.MaxGeneration property value can grow over time.

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


Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,