#40 – TrueString and FalseString

The System.Boolean type (bool) provides two fields that let you get string representations of the true and false values.

 string trueText = bool.TrueString;      // "True"
 string falseText = bool.FalseString;    // "False"

These fields return “True” and “False”, regardless of current regional settings or the native language of the operating system.

These values are identical to the string values returned from the System.Boolean.ToString() method, which can be called on an instance of bool.

 bool b1 = true;
 bool b2 = false;

 string true2 = b1.ToString();     // "True"
 string false2 = b2.ToString();    // "False"

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: