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
Boolean.ToString() Method in C#
The Boolean.ToString() method in C# converts the value of this instance to its equivalent string representation (either "True" or "False").
Syntax
Following is the syntax −
public override string ToString ();
Example
Let us now see an example to implement the Boolean.ToString() method −
using System;
public class Demo {
public static void Main(){
bool b = true;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}
Output
This will produce the following output −
Return Value = True
Example
Let us now see another example to implement the Boolean.ToString() method −
using System;
public class Demo {
public static void Main(){
bool b = false;
string res = b.ToString();
Console.WriteLine("Return Value = "+res);
}
}
Output
This will produce the following output −
Return Value = False
Advertisements