Char.ToString Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts the value of this instance to its equivalent string representation.
ToString(IFormatProvider) |
Converts the value of this instance to its equivalent string representation using the specified culture-specific format information. |
ToString(Char) |
Converts the specified Unicode character to its equivalent string representation. |
ToString() |
Converts the value of this instance to its equivalent string representation. |
The following code example demonstrates ToString.
using namespace System;
int main()
{
char ch = 'a';
Console::WriteLine( ch ); // Output: "a"
Console::WriteLine( Char::ToString( 'b' ) ); // Output: "b"
}
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"
}
}
open System
let ch = 'a'
printfn $"{ch.ToString()}" // Output: "a"
printfn $"{Char.ToString 'b'}" // Output: "b"
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
- Source:
- Char.cs
- Source:
- Char.cs
- Source:
- Char.cs
Converts the value of this instance to its equivalent string representation using the specified culture-specific format information.
public:
virtual System::String ^ ToString(IFormatProvider ^ provider);
public string ToString (IFormatProvider? provider);
public string ToString (IFormatProvider provider);
override this.ToString : IFormatProvider -> string
Public Function ToString (provider As IFormatProvider) As String
Parameters
- provider
- IFormatProvider
(Reserved) An object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by provider
.
Implements
Remarks
The provider
parameter is ignored; it does not participate in this operation.
See also
Applies to
.NET 9 et autres versions
Produit | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- Char.cs
- Source:
- Char.cs
- Source:
- Char.cs
Converts the specified Unicode character to its equivalent string representation.
public:
static System::String ^ ToString(char c);
public static string ToString (char c);
static member ToString : char -> string
Public Shared Function ToString (c As Char) As String
Parameters
- c
- Char
The Unicode character to convert.
Returns
The string representation of the value of c
.
See also
Applies to
.NET 9 et autres versions
Produit | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- Source:
- Char.cs
- Source:
- Char.cs
- Source:
- Char.cs
Converts the value of this instance to its equivalent string representation.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns
The string representation of the value of this instance.
See also
Applies to
.NET 9 et autres versions
Produit | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
Commentaires sur .NET
.NET est un projet open source. Sélectionnez un lien pour fournir des commentaires :