
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Char.Parse(String) Method in C#
The Char.Parse(String) method in C# is used to convert the value of the specified string to its equivalent Unicode character.
Syntax
Following is the syntax −
public static char Parse (string str);
Above, the string str is a string that contains a single character or null.
Example
Let us now see an example to implement the Char.Parse(String) method −
using System; public class Demo { public static void Main(){ string str ="a"; char res = Char.Parse(str); Console.WriteLine("Value = "+str); Console.WriteLine("Equivalent Unicode character = "+res); } }
Output
This will produce the following output −
Value = a Equivalent Unicode character = a
Example
Let us now see another example −
using System; public class Demo { public static void Main(){ string str ="#"; char res = Char.Parse(str); Console.WriteLine("Value = "+str); Console.WriteLine("Equivalent Unicode character = "+res); } }
Output
This will produce the following output −
Value = # Equivalent Unicode character = #
Advertisements