
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.TryParse() Method in C#
The Char.TryParse() method in C# is used to convert the value of the specified string to its equivalent Unicode character.
Syntax
public static bool TryParse (string str, out char res);
Let us now see an example to implement the Char.TryParse () method −
Example
using System; public class Demo { public static void Main(){ bool res; Char ch; res = Char.TryParse("10", out ch); Console.WriteLine(res); Console.WriteLine(ch.ToString()); } }
Output
This will produce the following output −
False
Let us now see another example −
Example
using System; public class Demo { public static void Main(){ bool res; Char ch; res = Char.TryParse("P", out ch); Console.WriteLine(res); Console.WriteLine(ch.ToString()); } }
Output
This will produce the following output −
True P
Advertisements