C# Convert ToSByte(Boolean)
Description
Convert ToSByte(Boolean)
converts the specified Boolean
value to the equivalent 8-bit signed integer.
Syntax
Convert.ToSByte(Boolean)
has the following syntax.
[CLSCompliantAttribute(false)]
public static sbyte ToSByte(
bool value
)
Parameters
Convert.ToSByte(Boolean)
has the following parameters.
value
- The Boolean value to convert.
Returns
Convert.ToSByte(Boolean)
method returns The number 1 if value is true; otherwise, 0.
Example
/*from w ww .j a v a 2 s .c o m*/
using System;
public class MainClass{
public static void Main(String[] argv){
Console.WriteLine(Convert.ToSByte(true));
}
}
The code above generates the following result.