Use this method to try to reclaim memory that is inaccessible. However, using this method does not guarantee that all inaccessible memory in the specified generation is reclaimed.
If object aging is implemented, the garbage collector does not collect objects with a generation number that is higher than the specified generation. If object aging is not implemented, the garbage collector considers all objects during the garbage collection.
Use the GC.MaxGeneration property to determine the maximum valid value of the generation parameter.
To have the garbage collector consider all objects regardless of their generation, use the version of this method that takes no parameters. To have the garbage collector reclaim objects based on a GCCollectionMode setting, use the GC.Collect(Int32,GCCollectionMode) method overload.
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 18.104.22.168, 22.214.171.124