Click or drag to resize
GCHandleAlloc Method (Object)
Allocates a Normal handle for the specified object.

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static GCHandle Alloc(
	Object value
)

Parameters

value
Type: SystemObject
The object that uses the GCHandle.

Return Value

Type: GCHandle
A new GCHandle that protects the object from garbage collection. This GCHandle must be released with Free when it is no longer needed.
Exceptions
ExceptionCondition
ArgumentExceptionAn instance with nonprimitive (non-blittable) members cannot be pinned.
See Also