C# Decimal ToSByte

Description

Decimal ToSByte converts the value of the specified Decimal to the equivalent 8-bit signed integer.

Syntax

Decimal.ToSByte has the following syntax.


[CLSCompliantAttribute(false)]
public static sbyte ToSByte(
  decimal value
)

Parameters

Decimal.ToSByte has the following parameters.

  • value - The decimal number to convert.

Returns

Decimal.ToSByte method returns An 8-bit signed integer equivalent to value.

Example

The following example uses the ToSByte method to convert decimal numbers to SByte values.


/*from www.java  2 s .c o m*/
using System;

class Example
{
   public static void Main( )
   {
      sbyte number = Decimal.ToSByte(78.999m);
      Console.WriteLine(number);       
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version