Export (0) Print
Expand All

Char.ConvertToUtf32 Method (Char, Char)

Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.

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

static member ConvertToUtf32 : 
        highSurrogate:char * 
        lowSurrogate:char -> int

Parameters

highSurrogate
Type: System.Char

A high surrogate code unit (that is, a code unit ranging from U+D800 through U+DBFF).

lowSurrogate
Type: System.Char

A low surrogate code unit (that is, a code unit ranging from U+DC00 through U+DFFF).

Return Value

Type: System.Int32
The 21-bit Unicode code point represented by the highSurrogate and lowSurrogate parameters.

ExceptionCondition
ArgumentOutOfRangeException

highSurrogate is not in the range U+D800 through U+DBFF, or lowSurrogate is not in the range U+DC00 through U+DFFF.

Use this method to convert a surrogate pair into a 21-bit Unicode code point. To convert UTF-16 data into UTF-32 data, use the System.Text.UTF32Encoding class.

Ordinarily, UTF-16 encoding represents a single Unicode character as a 16-bit code unit. However, it also supports surrogate pairs, which allow a single abstract character to be represented as two 16-bit code units. These two Char objects must have code units that range from U+D800 to U+DBFF for the first (high) surrogate and from U+DC00 to U+DFFF for the second (low) surrogate. Surrogate pairs are supported only by UTF-16 encoding. This method allows a character represented by a UTF-16 surrogate pair to be converted to a character using UTF-32 encoding.

The following code example demonstrates the ConvertToUtf32 and ConvertFromUtf32 methods.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft