WindowsRuntimeMarshal.StringToHString(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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.
s
is null
.
Remarks
Use the FreeHString method to release the HSTRING when you are done using it.