Pointer::Box Method (Void*, Type^)

 

Boxes the supplied unmanaged memory pointer and the type associated with that pointer into a managed Pointer wrapper object. The value and the type are saved so they can be accessed from the native code during an invocation.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public:
[SecurityCriticalAttribute]
static Object^ Box(
	void* ptr,
	Type^ type
)

Parameters

ptr
Type: System::Void*

The supplied unmanaged memory pointer.

type
Type: System::Type^

The type associated with the ptr parameter.

Return Value

Type: System::Object^

A pointer object.

Exception Condition
ArgumentException

type is not a pointer.

ArgumentNullException

type is null.

SecurityCriticalAttribute

Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

.NET Framework
Available since 1.1
Return to top
Show: