C# bool

bool data type has two values, true and false.

using System.Windows.Forms;
bool b = 5 > 4;
MessageBox.Show(b.ToString()); //true

The default value of bool is false.
bool b = default(bool);
MessageBox.Show(b.ToString()); //false

bool used in the condition.
bool b = 5 < 4;
if (!b)
MessageBox.Show(b.ToString()); //false

bool array.
bool[] arr = new bool[5];
bool[] arr = new bool[]{true,false,true};



endmemo.com © 2017  Terms of Use | Home