Default value of bool in C#

CsharpProgrammingServer Side Programming

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 −


 Live Demo

using System;

public class Demo {
   public static void Main() {
      bool a = default(bool);
      // default for bool
      Console.WriteLine("Default for bool type = "+a);


The following is the output. It shows a blank space i.e. False.

Default for bool type = False
Updated on 22-Jun-2020 13:48:03