GCHandleAlloc Method (Object) |
Allocates a Normal handle for the specified object.
Namespace: System.Runtime.InteropServicesAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static GCHandle Alloc(
Object value
)
Parameters
- value
- Type: SystemObject
The object that uses the GCHandle.
Return Value
Type:
GCHandleA new
GCHandle that protects the object from garbage collection. This
GCHandle must be released with
Free when it is no longer needed.
Exceptions Exception | Condition |
---|
ArgumentException | An instance with nonprimitive (non-blittable) members cannot be pinned. |
See Also