Export (0) Print
Expand All

BitConverter.ToChar Method

Returns a Unicode character converted from two bytes at a specified position in a byte array.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

static member ToChar : 
        value:byte[] * 
        startIndex:int -> char


Type: System.Byte[]

An array.

Type: System.Int32

The starting position within value.

Return Value

Type: System.Char
A character formed by two bytes beginning at startIndex.


startIndex equals the length of value minus 1.


value is a null reference (Nothing in Visual Basic).


startIndex is less than zero or greater than the length of value minus 1.

The ToChar method converts the bytes from index startIndex to startIndex + 1 to a Char value. The order of bytes in the array must reflect the endianness of the computer system's architecture; for more information, see the Remarks section of the BitConverter class topic.

The following code example converts elements of Byte arrays to Char values (Unicode characters) with the ToChar method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
© 2015 Microsoft