Char.Parse Method (String)

 

Converts the value of the specified string to its equivalent Unicode character.

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

public static char Parse(
	string s
)

Parameters

s
Type: System.String

A string that contains a single character, or null.

Return Value

Type: System.Char

A Unicode character equivalent to the sole character in s.

Exception Condition
ArgumentNullException

s is null.

FormatException

The length of s is not 1.

The following code example demonstrates Parse.

using System;

public class ParseSample {
	public static void Main() {
		Console.WriteLine(Char.Parse("A")); // Output: 'A'
	}
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: