The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
BitConverter::GetBytes Method (Char)
.NET Framework (current version)
Returns the specified Unicode character value as an array of bytes.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
-
Type:
System::Char
A character to convert.
The order of bytes in the array returned by the GetBytes method depends on whether the computer architecture is little-endian or big-endian.
The following code example converts the bit patterns of Char values (Unicode characters) to Byte arrays with the GetBytes method.
// Example of the BitConverter::GetBytes( __wchar_t ) method. using namespace System; // Convert a __wchar_t argument to a byte array and display it. void GetBytesChar( __wchar_t argument ) { array<Byte>^byteArray = BitConverter::GetBytes( argument ); Console::WriteLine( "{0,10}{1,16}", argument, BitConverter::ToString( byteArray ) ); } int main() { Console::WriteLine( "This example of the BitConverter::GetBytes( __wchar_t ) " "\nmethod generates the following output.\n" ); Console::WriteLine( "{0,10}{1,16}", "__wchar_t", "byte array" ); Console::WriteLine( "{0,10}{1,16}", "---------", "----------" ); // Convert __wchar_t values and display the results. GetBytesChar( L'\0' ); GetBytesChar( L' ' ); GetBytesChar( L'*' ); GetBytesChar( L'3' ); GetBytesChar( L'A' ); GetBytesChar( L'[' ); GetBytesChar( L'a' ); GetBytesChar( L'{' ); } /* This example of the BitConverter::GetBytes( __wchar_t ) method generates the following output. __wchar_t byte array --------- ---------- 00-00 20-00 * 2A-00 3 33-00 A 41-00 [ 5B-00 a 61-00 { 7B-00 */
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: