Mono Class Library: System.GC Overview | Members

System.GC.SuppressFinalize Method

Instructs the garbage collector not to call the object.Finalize method on the specified object.

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public static void SuppressFinalize (object obj)

Parameters

obj
The object whose object.Finalize method will not be called.

Exceptions

TypeReason
ArgumentNullExceptionobj is a null reference.
InvalidOperationExceptionThe caller of this method is not the same as the object passed to this method.

Remarks

The method removes obj from the set of objects that require finalization. obj is required to be the caller of this method.

Note: Objects that implement the IDisposable interface should call this method from the IDisposable.Dispose method to prevent the garbage collector from calling object.Finalize on an object that does not require it.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0