<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=C_Sharp_bool</id>
	<title>C Sharp bool - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=C_Sharp_bool"/>
	<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=C_Sharp_bool&amp;action=history"/>
	<updated>2026-05-19T01:40:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://coderwiki.org/index.php?title=C_Sharp_bool&amp;diff=148&amp;oldid=prev</id>
		<title>Dylan: new: info, size, true and false, example</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=C_Sharp_bool&amp;diff=148&amp;oldid=prev"/>
		<updated>2025-08-19T12:52:24Z</updated>

		<summary type="html">&lt;p&gt;new: info, size, true and false, example&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;bool&amp;#039;&amp;#039;&amp;#039; [[class]] in [[C Sharp|C#]] is a [[data type]] which can store one of two [[Value|values]]:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Booleans are especially useful when working with [[Condition|conditions]].&lt;br /&gt;
&lt;br /&gt;
See [[Boolean]] for general information about the uses and representation of boolean data types.&lt;br /&gt;
&lt;br /&gt;
== Size ==&lt;br /&gt;
While a boolean &amp;#039;&amp;#039;could&amp;#039;&amp;#039; technically store a bool as a single [[bit]], this wouldn&amp;#039;t necessarily be optimal for [[memory layout]].&lt;br /&gt;
&lt;br /&gt;
For this reason, booleans in C# are stored as 1 [[byte]] in [[memory]].&lt;br /&gt;
&lt;br /&gt;
== Keywords: true and false ==&lt;br /&gt;
C# gives us two [[Keyword|keywords]] for the boolean values &amp;#039;&amp;#039;&amp;#039;true&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;false&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
The keywords are, logically, [[C Sharp true|&amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;]] and [[C Sharp false|&amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;]] respectively.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cs&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
bool a = true;&lt;br /&gt;
bool b = false;&lt;br /&gt;
bool c = Convert.ToBoolean(1); // true&lt;br /&gt;
bool d = Convert.ToBoolean(0); // false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
</feed>