System.Runtime.InteropServices.CriticalHandle.SetHandle Method

Sets the handle to the specified pre-existing handle.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
protected void SetHandle (IntPtr handle)

Parameters

handle
The pre-existing handle to use.

Remarks

Use the CriticalHandle.SetHandle(IntPtr) method only if you need to support a pre-existing handle (for example, if the handle is returned in a structure) because the .NET Framework COM interop infrastructure does not support marshaling handles in a structure.

Requirements

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