C# Convert ToSByte(Single)
Description
Convert ToSByte(Single)
converts the value of the specified
single-precision floating-point number to an equivalent 8-bit signed
integer.
Syntax
Convert.ToSByte(Single)
has the following syntax.
[CLSCompliantAttribute(false)]
public static sbyte ToSByte(
float value
)
Parameters
Convert.ToSByte(Single)
has the following parameters.
value
- The single-precision floating-point number to convert.
Returns
Convert.ToSByte(Single)
method returns value, rounded to the nearest 8-bit signed integer. If value is halfway between
two whole numbers, the even number is returned; that is, 4.5 is converted
to 4, and 5.5 is converted to 6.
Example
//from www . ja v a2s. c om
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToSByte((Single)123.123F));
}
}
The code above generates the following result.