GC.SuppressFinalize Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Requests that the system not call the finalizer for the specified object.

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

Syntax

Public Shared Sub SuppressFinalize ( _
    obj As Object _
)
public static void SuppressFinalize(
    Object obj
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

obj is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

This method sets a bit in the object header, which the system checks when calling finalizers. The obj parameter is required to be the caller of this method.

Objects that implement the IDisposable interface can 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.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

GC Class

System Namespace

ReRegisterForFinalize