다음을 통해 공유


CryptographicBuffer.ConvertStringToBinary 메서드

정의

문자열을 인코딩된 버퍼로 변환합니다.

public:
 static IBuffer ^ ConvertStringToBinary(Platform::String ^ value, BinaryStringEncoding encoding);
 static IBuffer ConvertStringToBinary(winrt::hstring const& value, BinaryStringEncoding const& encoding);
public static IBuffer ConvertStringToBinary(string value, BinaryStringEncoding encoding);
function convertStringToBinary(value, encoding)
Public Shared Function ConvertStringToBinary (value As String, encoding As BinaryStringEncoding) As IBuffer

매개 변수

value
String

Platform::String

winrt::hstring

인코딩할 문자열입니다.

encoding
BinaryStringEncoding

인코딩 형식입니다.

반환

인코딩된 버퍼입니다.

예제

public void ConvertData()
{
    // Create a string to convert.
    String strIn = "Input String";

    // Convert the string to UTF16BE binary data.
    IBuffer buffUTF16BE = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf16BE);

    // Convert the string to UTF16LE binary data.
    IBuffer buffUTF16LE = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf16LE);

    // Convert the string to UTF8 binary data.
    IBuffer buffUTF8 = CryptographicBuffer.ConvertStringToBinary(strIn, BinaryStringEncoding.Utf8);
}

적용 대상