Export (0) Print
Expand All

Int16.ToString Method

Converts the numeric value of this instance to its equivalent string representation.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

[SecuritySafeCriticalAttribute]
public override string ToString()

Return Value

Type: System.String
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.

The return value is formatted with the general numeric format specifier ("G") and the NumberFormatInfo for the current culture. To define the formatting of the Int16 value's string representation, call the Int16.ToString(String) method. To define both the formatting and culture used to create the string representation of an Int16 value, call the Int16.ToString(String, IFormatProvider) method.

The .NET Framework provides extensive formatting support, which is described in greater detail in the following formatting topics:

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


short[] numbers = {0, 14624, 13982, short.MaxValue, 
                   short.MinValue, -16667};
foreach (short number in numbers)
{
   outputBlock.Text += number.ToString() + "\n";
}
// The example displays the following output:
//       0
//       14624
//       13982
//       32767
//       -32768
//       -16667                             


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft