StructureToPtr Method

Marshal.StructureToPtr Method

For apps that target Windows Phone OS 7.0 and 7.1, do not use any members of this type in your app. If you do, your code will throw a MethodAccessException. This type is security-critical, which restricts it to internal use by the .NET Framework for Windows Phone class library.
[SECURITY CRITICAL]

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace:  System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

[SecurityCriticalAttribute]
public static void StructureToPtr(
	Object structure,
	IntPtr ptr,
	bool fDeleteOld
)

Parameters

structure
Type: System.Object
A managed object holding the data to be marshaled. This object must be an instance of a formatted class.
ptr
Type: System.IntPtr
A pointer to an unmanaged block of memory, which must be allocated before this method is called.
fDeleteOld
Type: System.Boolean
true to free the memory that the ptr parameter points to, before this method executes. Note that passing false can lead to a memory leak.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft