Edit

Share via


WindowsRuntimeMarshal.StringToHString(String) Method

Definition

Allocates a Windows RuntimeHSTRING and copies the specified managed string to it.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 static IntPtr StringToHString(System::String ^ s);
[System.Security.SecurityCritical]
public static IntPtr StringToHString (string s);
public static IntPtr StringToHString (string s);
[<System.Security.SecurityCritical>]
static member StringToHString : string -> nativeint
static member StringToHString : string -> nativeint
Public Shared Function StringToHString (s As String) As IntPtr

Parameters

s
String

The managed string to copy.

Returns

IntPtr

nativeint

An unmanaged pointer to the new HSTRING, or Zero if s is Empty.

Attributes

Exceptions

The Windows Runtime is not supported on the current version of the operating system.

Remarks

Use the FreeHString method to release the HSTRING when you are done using it.

Applies to

See also