C# BitConverter GetBytes(Char)
Description
BitConverter GetBytes(Char)
returns the specified
Unicode character value as an array of bytes.
Syntax
BitConverter.GetBytes(Char)
has the following syntax.
public static byte[] GetBytes(
char value
)
Parameters
BitConverter.GetBytes(Char)
has the following parameters.
value
- A character to convert.
Returns
BitConverter.GetBytes(Char)
method returns
Example
The following code example converts the bit patterns of Char values (Unicode characters) to Byte arrays with the GetBytes method.
/*from w w w .j ava 2 s. c o m*/
using System;
class GetBytesUInt64Demo
{
public static void Main( )
{
byte[ ] byteArray = BitConverter.GetBytes( 'a' );
Console.WriteLine(BitConverter.ToString( byteArray ) );
}
}
The code above generates the following result.