GC.GetGeneration Method (Object)
Returns the current generation number of the specified object.
Assembly: mscorlib (in mscorlib.dll)
Use this method to determine the age of an object, and then use that information with the Collect method to force the garbage collector to collect objects in the same generation. For example, use this method when you have a set of objects that are created as a group and that become inaccessible at the same time.
The following example demonstrates how to use themethod to determine the age of an object. The example then performs garbage collections to clean up memory and compare the pre and post collection memory totals in the console.
Available since 10
Available since 1.1
Windows Phone Silverlight
Available since 7.1