SafeHandle.SetHandleAsInvalid SafeHandle.SetHandleAsInvalid SafeHandle.SetHandleAsInvalid SafeHandle.SetHandleAsInvalid Method

Definition

Marks a handle as no longer used.

public:
 void SetHandleAsInvalid();
[System.Security.SecurityCritical]
public void SetHandleAsInvalid ();
member this.SetHandleAsInvalid : unit -> unit
Public Sub SetHandleAsInvalid ()

Remarks

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.

Security

SecurityPermission
for permission to call unmanaged code. Security action: LinkDemand. Associated enumeration: UnmanagedCode

Applies to