C# SByte ToString()

Description

SByte ToString() converts the numeric value of this instance to its equivalent string representation.

Syntax

SByte.ToString() has the following syntax.


public override string ToString()

Returns

SByte.ToString() method returns The string representation of the value of this instance, consisting of a negative sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.

Example

The following example displays an SByte value using the default ToString() method.


using System;/*from w  w  w  .ja  v  a  2 s. co m*/

public class Example
{
   public static void Main()
   {
      sbyte value = -123;
      Console.WriteLine(value.ToString());            
      Console.WriteLine(value.ToString("G"));         
      Console.WriteLine(value.ToString("C"));       
      Console.WriteLine(value.ToString("D"));       
      Console.WriteLine(value.ToString("F"));       
      Console.WriteLine(value.ToString("N"));       
      Console.WriteLine(value.ToString("X"));       
   }
}

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