다음을 통해 공유


GC.SuppressFinalize Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Shared Sub SuppressFinalize ( _
    obj As Object _
)
[SecuritySafeCriticalAttribute]
public static void SuppressFinalize(
    Object obj
)

Parameters

  • obj
    Type: System.Object
    The object that a finalizer must not be called for.

Exceptions

Exception Condition
ArgumentNullException

obj is nulla 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

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.