
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Convert.ToSByte Method in C#
Convert a specified value to an 8-bit signed integer i.e. SByte.
It is a signed 8-bit integer data type which stores value between -128 to 127.
Let us see an example. We have a double variable.
double doubleNum = -19.9;
Now, let us convert it to SByte.
sbyte res; res = Convert.ToSByte(doubleNum);
Example
using System; public class Demo { public static void Main() { double doubleNum = -19.9; sbyte res; res = Convert.ToSByte(doubleNum); Console.WriteLine("Converted {0} to {1}", doubleNum, res); } }
Output
Converted -19.9 to -20
- Related Articles
- How to Convert the TimeSeries using the series.asfreq() method?
- Convert Long into String using toString() method of Long class in java
- Is there any method to convert a Set to immutable in Java
- Convert an object to another type using map() method with Lambda in Java?
- What is the equivalent of MySQL TIME_TO_SEC() method in PHP to convert datetime to seconds?
- Java Program to convert Double into String using toString() method of Double class
- How to convert a double value into a Java String using format method?
- How to convert a double value into a Java String using append method?
- Convert Class in C#
- Class method vs static method in Python
- Collections.replaceAll() method and List.replaceAll() method in Java
- The isEmpty() method of CopyOnWriteArrayList method in Java
- The hashCode() method of CopyOnWriteArrayList method in Java
- The clone() method of CopyOnWriteArrayList method in Java
- Default method vs static method in an interface in Java?
- Convert String to Long in Java

Advertisements