System.Runtime.InteropServices.Marshal.PtrToStructure Method

Marshals data from an unmanaged block of memory to a managed object.

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public static void PtrToStructure (IntPtr ptr, object structure)

Parameters

ptr
A pointer to an unmanaged block of memory.
structure
The object to which the data is to be copied. This must be an instance of a formatted class.

Remarks

Marshal.PtrToStructure(IntPtr, object) is often necessary in COM interop and platform invoke when structure parameters are represented as an IntPtr value. You cannot use this overload method with value types.

Requirements

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