ToString Method (Char)

Convert.ToString Method (Char)

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

Converts the value of the specified Unicode character to its equivalent String representation.

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

Public Shared Function ToString ( _
	value As Char _
) As String


Type: System.Char
A Unicode character.

Return Value

Type: System.String
The String equivalent of the value of value.

This implementation is identical to Char.ToString.

The following code sample illustrates the conversion of a Char to a String, using ToString.

Public Sub ConvertStringChar(ByVal stringVal As String)
   Dim charVal As Char = "a"c

   ' A string must be one character long to convert to char.
      charVal = System.Convert.ToChar(stringVal)
      outputBlock.Text &= String.Format("{0} as a char is {1}", _
                                stringVal, charVal) & vbCrLf
   Catch exception As System.FormatException
      outputBlock.Text &= String.Format( _
       "The string is longer than one character.") & vbCrLf
   Catch exception As System.ArgumentNullException
      outputBlock.Text &= "The string is null." & vbCrLf
   End Try

   ' A char to string conversion will always succeed.
   stringVal = System.Convert.ToString(charVal)
   outputBlock.Text &= String.Format("The character as a string is {0}", _
                             stringVal) & vbCrLf
End Sub

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2016 Microsoft