Char.ConvertFromUtf32 Method

July 28, 2014

Converts the specified Unicode code point into a UTF-16 encoded string.

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

public static string ConvertFromUtf32(
	int utf32
)

Parameters

utf32
Type: System.Int32
A 21-bit Unicode code point.

Return Value

Type: System.String
A string consisting of one Char object or a surrogate pair of Char objects equivalent to the code point specified by the utf32 parameter.

ExceptionCondition
ArgumentOutOfRangeException

utf32 is not a valid 21-bit Unicode code point ranging from U+0 through U+10FFFF, excluding the surrogate pair range from U+D800 through U+DFFF.

Use this method to convert a 21-bit Unicode code point to a UTF-16 encoded string before testing the string with methods such as IsLowSurrogate(Char) and IsHighSurrogate(Char).

A valid code point outside the Basic Multilingual Plane (BMP) always yields a valid surrogate pair. However, a valid code point within the BMP might not yield a valid result according to the Unicode standard because no linguistic processing is used in the conversion.

The following code example demonstrates the ConvertToUtf32 and ConvertFromUtf32 methods.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2014 Microsoft