CryptographicBuffer.ConvertStringToBinary(String, BinaryStringEncoding) CryptographicBuffer.ConvertStringToBinary(String, BinaryStringEncoding) CryptographicBuffer.ConvertStringToBinary(String, BinaryStringEncoding) CryptographicBuffer.ConvertStringToBinary(String, BinaryStringEncoding) CryptographicBuffer.ConvertStringToBinary(String, BinaryStringEncoding) Method

Definition

Converts a string to an encoded buffer.

public : static IBuffer ConvertStringToBinary(Platform::String value, BinaryStringEncoding encoding)
static IBuffer ConvertStringToBinary(winrt::hstring value, BinaryStringEncoding encoding) const;
public static IBuffer ConvertStringToBinary(String value, BinaryStringEncoding encoding)
Public Shared Function ConvertStringToBinary(value As String, encoding As BinaryStringEncoding) As IBuffer
var iBuffer = Windows.Security.Cryptography.CryptographicBuffer.convertStringToBinary(value, encoding);

Parameters

value
String String String

String to be encoded.

Returns

Encoded buffer.

Examples

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