Export (0) Print
Expand All

SafeHandle.SetHandleAsInvalid Method

Marks a handle as no longer used.

Namespace:  System.Runtime.InteropServices
Assemblies:   mscorlib (in mscorlib.dll)
  System.Runtime.Handles (in System.Runtime.Handles.dll)

public void SetHandleAsInvalid()

Call the SetHandleAsInvalid method only when you know that your handle no longer references a resource. Doing so does not change the value of the handle field; it only marks the handle as closed. The handle might then contain a potentially stale value. The effect of this call is that no attempt is made to free the resources.

As with the SetHandle method, use SetHandleAsInvalid only if you need to support a pre-existing handle.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Show:
© 2015 Microsoft