GC::Collect Method
.NET Framework (current version)
Forces garbage collection.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | Collect() | Forces an immediate garbage collection of all generations. |
![]() ![]() | Collect(Int32) | Forces an immediate garbage collection from generation 0 through a specified generation. |
![]() ![]() | Collect(Int32, GCCollectionMode) | Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value. |
![]() ![]() | Collect(Int32, GCCollectionMode, Boolean) | Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value, with a value specifying whether the collection should be blocking. |
![]() ![]() | Collect(Int32, GCCollectionMode, Boolean, Boolean) | Forces a garbage collection from generation 0 through a specified generation, at a time specified by a GCCollectionMode value, with values that specify whether the collection should be blocking and compacting. |
Show:

