System.Runtime.InteropServices.CriticalHandle.SetHandleAsInvalid Method

Marks a handle as invalid.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public void SetHandleAsInvalid ()

Remarks

Call the CriticalHandle.SetHandleAsInvalid method only when you know that your handle is invalid and you want to mark it as such. Doing so does not change the value of the CriticalHandle.handle field; it only marks the handle as invalid. 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 CriticalHandle.SetHandle(IntPtr) method, use CriticalHandle.SetHandleAsInvalid only if you need to support a pre-existing handle.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0