C# Int16 ToString()

Description

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

Syntax

Int16.ToString() has the following syntax.


public override string ToString()

Returns

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

Example

The following example uses the ToString() method to display an array of Int16 values to the console.


// w w  w.ja  va2 s .  c  o  m
using System;
public class MainClass{
  public static void Main(String[] argv){  
    short[] numbers = {0, 12345, 12345, short.MaxValue, 
                       short.MinValue, -12345};
    foreach (short number in numbers)
    {
       Console.WriteLine(number.ToString());
    }            

  }
}
    

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