Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Char.ToString() Method in C#
The Char.ToString() method in C# is used to convert the value of this instance to its equivalent string representation.
Syntax
Following is the syntax −
public override string ToString ();
Example
Let us now see an example to implement the Char.ToString() method −
using System;
public class Demo {
public static void Main(){
char ch = 'p';
Console.WriteLine("Value = "+ch);
char res1 = Char.ToLowerInvariant(ch);
Console.WriteLine("Lowercase Equivalent = "+res1);
string res2 = ch.ToString();
Console.WriteLine("String Equivalent = "+res2);
}
}
Output
This will produce the following output −
Value = p Lowercase Equivalent = p String Equivalent = p
Example
Let us now see another example −
using System;
public class Demo {
public static void Main(){
char ch = 'D';
Console.WriteLine("Value = "+ch);
char res1 = Char.ToLowerInvariant(ch);
Console.WriteLine("Lowercase Equivalent = "+res1);
string res2 = ch.ToString();
Console.WriteLine("String Equivalent = "+res2);
}
}
Output
This will produce the following output −
Value = D Lowercase Equivalent = d String Equivalent = D
Advertisements
