Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert.ToSByte(String, IFormatProvider) Method in C#
The Convert.ToSByte() method in C# converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information.
Syntax
Following is the syntax −
public static sbyte ToSByte (string val, IFormatProvider provider);
Above, the parameter value is a string that contains the number to convert. A provider parameter is an object that supplies culture-specific formatting information.
Example
Let us now see an example to implement the Convert.ToSByte() method −
using System;
using System.Globalization;
public class Demo {
public static void Main(){
CultureInfo cultures = new CultureInfo("en-US");
String str = "-2";
Console.WriteLine("Converted sbyte value...");
sbyte res = Convert.ToSByte(str, cultures);
Console.Write("{0}", res);
}
}
Output
This will produce the following output −
Converted sbyte value... -2
Advertisements
