CryptographicBuffer.ConvertStringToBinary Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a string to an encoded buffer.
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
Parameters
- value
-
String
Platform::String
winrt::hstring
String to be encoded.
- encoding
- BinaryStringEncoding
Encoding format.
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);
}
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for