GC.GetGeneration Method (WeakReference)

 

Returns the current generation number of the target of a specified weak reference.

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

static member GetGeneration : 
        wo:WeakReference -> int

Parameters

wo
Type: System.WeakReference

A WeakReference that refers to the target object whose generation number is to be determined.

Return Value

Type: System.Int32

The current generation number of the target of wo.

Exception Condition
ArgumentException

Garbage collection has already been performed on wo.

The following example demonstrates the use of the GetGeneration method to determine the age of a weak reference object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: