![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements