ToString Method
Collapse the table of content
Expand the table of content

Int16.ToString Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

'Declaration
Public Overrides Function ToString As String

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.


Dim numbers() As Short = {0, 14624, 13982, Short.MaxValue, _
                         Short.MinValue, -16667}
For Each number As Short In numbers
   outputBlock.Text &= number.ToString() & vbCrLf
Next
' The example displays the following output:
'       0
'       14624
'       13982
'       32767
'       -32768
'       -16667                             


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft