WindowsRuntimeMarshal.StringToHString(String) 方法

定义

分配 Windows 运行时HSTRING 并将指定的托管字符串复制到其中。Allocates a Windows RuntimeHSTRING and copies the specified managed string to it.

此 API 支持产品基础结构,不能在代码中直接使用。

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

参数

s
String

要复制的托管字符串。The managed string to copy.

返回

IntPtr

一个指向新 HSTRING 的非托管指针;如果 sEmpty,则为 ZeroAn unmanaged pointer to the new HSTRING, or Zero if s is Empty.

属性

例外

当前版本的操作系统不支持 Windows 运行时。The Windows Runtime is not supported on the current version of the operating system.

snulls is null.

注解

使用 FreeHString 方法在完成使用后释放 HSTRINGUse the FreeHString method to release the HSTRING when you are done using it.

适用于

另请参阅