System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode Method

Copies the contents of a managed System.Security.SecureString object into unmanaged memory.

Syntax

public static IntPtr SecureStringToGlobalAllocUnicode (System.Security.SecureString s)

Parameters

s
The managed object to copy.

Returns

The address, in unmanaged memory, where s was copied, or 0 if s is a System.Security.SecureString object whose length is 0.

Remarks

The Marshal.SecureStringToGlobalAllocUnicode(System.Security.SecureString) method is useful for custom marshaling or for use when mixing managed and unmanaged code. Because this method allocates the unmanaged memory required for a string, always free the memory by calling the Marshal.ZeroFreeGlobalAllocUnicode(IntPtr) method.

Requirements

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