共用方式為


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);
}

適用於