Share via


GC.MaxGeneration Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Shared ReadOnly Property MaxGeneration As Integer
public static int MaxGeneration { get; }

Property Value

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

Remarks

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.

Version Information

Silverlight

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

Platforms

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

See Also

Reference