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
Convert string to bool in C#
To convert a string to a bool, use the Bool.parse method in C# −
Firstly, set a string −
string str = "false";
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 = "false";
bool res = bool.Parse(str);
Console.WriteLine(res);
}
}
Output
False
Advertisements
