- 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
Default value of bool in C#
Use the default operator to get the default value of bool type −
bool a = default(bool);
Above, we have used the default keyword to get the default value.
Let us see the code to display default value of bool −
Example
using System; public class Demo { public static void Main() { bool a = default(bool); // default for bool Console.WriteLine("Default for bool type = "+a); } }
Output
The following is the output. It shows a blank space i.e. False.
Default for bool type = False
Advertisements