GC.MaxGeneration Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the maximum number of generations that the system currently supports.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Int32A 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 ImplementersFor this implementation, the value returned by the MaxGeneration property is guaranteed to remain constant for the lifetime of an executing application.