Convert.ToSByte Method (Char)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Converts the value of the specified Unicode character to the equivalent 8-bit signed integer.

This API is not CLS-compliant.

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

public static sbyte ToSByte(
	char value


Type: System.Char

The Unicode character to convert.

Return Value

Type: System.SByte

An 8-bit signed integer that is equivalent to value.

Exception Condition

value is greater than SByte.MaxValue.

The following example attempts to convert each element in an array of Char values to a signed byte.

char[] chars = { 'a', 'z', '\u0007', '\u0200', '\u1023' };
foreach (char ch in chars)
   try {
      sbyte result = Convert.ToSByte(ch);
      Console.WriteLine("{0} is converted to {1}.", ch, result);
   catch (OverflowException) {
      Console.WriteLine("Unable to convert u+{0} to a byte.",
// The example displays the following output:
//    a is converted to 97.
//    z is converted to 122.
//     is converted to 7.
//    Unable to convert u+00C8 to a byte.
//    Unable to convert u+03FF to a byte.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top