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
Convert the specified string representation of a logical value to its Boolean equivalent in C#
To convert the specified string representation of a logical value to its Boolean equivalent, the code is as follows −
Example
using System;
public class Demo {
public static void Main(){
bool val;
bool flag;
val = Boolean.TryParse("true", out flag);
Console.WriteLine("Result = "+val);
}
}
Output
This will produce the following output −
Example
using System;
public class Demo {
public static void Main() {
bool val; bool flag;
val = Boolean.TryParse("$", out flag);
Console.WriteLine("Result = "+val);
}
}
Output
This will produce the following output −
Result = False
Advertisements