Char.ToString Method
.NET Framework 1.1
Converts the value of this instance to its equivalent string representation.
Overload List
Converts the value of this instance to its equivalent string representation.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Overrides Public Function ToString() As String
[C#] public override string ToString();
[C++] public: String* ToString();
[JScript] public override function ToString() : String;
Converts the specified Unicode character to its equivalent string representation.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Shared Function ToString(Char) As String
[C#] public static string ToString(char);
[C++] public: static String* ToString(__wchar_t);
[JScript] public static function ToString(Char) : String;
Converts the value of this instance to its equivalent string representation using the specified culture-specific format information.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Overridable Function ToString(IFormatProvider) As String
[C#] public virtual string ToString(IFormatProvider);
[C++] public: virtual String* ToString(IFormatProvider*);
[JScript] public function ToString(IFormatProvider) : String;
Example
[Visual Basic, C#, C++] The following sample demonstrates an overload of ToString.
[Visual Basic, C#, C++] Note This example shows how to use one of the overloaded versions of ToString. For other examples that might be available, see the individual overload topics.
[Visual Basic] Imports System Module ToStringSample Sub Main() Dim ch As Char ch = "a"c Console.WriteLine(ch.ToString()) ' Output: "a" Console.WriteLine(Char.ToString("b"c)) ' Output: "b" End Sub End Module [C#] using System; public class ToStringSample { public static void Main() { char ch = 'a'; Console.WriteLine(ch.ToString()); // Output: "a" Console.WriteLine(Char.ToString('b')); // Output: "b" } } [C++] #using <mscorlib.dll> using namespace System; int main() { char ch = 'a'; Console::WriteLine(__box(ch)); // Output: "a" Console::WriteLine(Char::ToString('b')); // Output: "b" }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.