- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Bool.parse method in C#
To convert a string to a bool, use the Bool.parse method in C# −
Firstly, set a string −
string str = "true";
Now, convert it to bool −
bool.Parse(str);
Here is the complete code −
Example
using System; using System.Linq; class Demo { static void Main() { string str = "true"; bool res = bool.Parse(str); Console.WriteLine(res); } }
Output
True
Advertisements