CryptographicBuffer.EncodeToHexString(IBuffer) 方法

定义

将缓冲区编码为十六进制字符串。

public:
 static Platform::String ^ EncodeToHexString(IBuffer ^ buffer);
 static winrt::hstring EncodeToHexString(IBuffer const& buffer);
public static string EncodeToHexString(IBuffer buffer);
function encodeToHexString(buffer)
Public Shared Function EncodeToHexString (buffer As IBuffer) As String

参数

buffer
IBuffer

输入缓冲区。

返回

String

Platform::String

winrt::hstring

十六进制编码的输出字符串。

示例

public void EncodeDecodeHex()
{
    // Define a hexadecimal string.
    String strHex = "30310AFF";

    // Decode a hexadecimal string to binary.
    IBuffer buffer = CryptographicBuffer.DecodeFromHexString(strHex);

    // Encode the buffer back into a hexadecimal string.
    String strHexNew = CryptographicBuffer.EncodeToHexString(buffer);
}

适用于