This method is used to convert the value of the specified Decimal to the equivalent 8-bit signed integer. A user can also convert a Decimal value to an 8-bit integer by using the Explicit assignment operator.
Syntax: public static sbyte ToSByte (decimal value);
Here, the value is the decimal number which is to be converted.
Return Value: It returns a 8-bit signed integer equivalent to the specified value.
Exception: This method will give OverflowException if the specified value is less than MinValue or greater than MaxValue.
Below programs illustrate the use of the above-discussed method:
The SByte value is : 127 The SByte value is : 4
Exception Thrown: System.OverflowException
- Difference between Method Overriding and Method Hiding in C#
- C# | Dictionary.Add() Method
- C# | Math.Log() Method
- C# | Copy() Method
- C# | IndexOfAny() Method
- C# | ToUpper() Method
- Extension Method in C#
- Method Hiding in C#
- Queue.Contains() Method in C#
- C# | PadRight() Method
- C# | Math.Pow() Method
- C# | Method Overriding
- C# | Method Overloading
- C# | Random.Next() Method
- C# | SortedDictionary.Add() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.