How to determine if a bool variable has not been assigned a value?
How do I determine if a bool variable has not been assigned a value in C#?
Before I set a bool variable already declared, I assume it is a value of null.
What is the syntax to determine if it is null?
If I do the following I get an error that I can't use "==" on a bool:
bool test;
if ( test == null )
{
// This bool var has not been assigned yet.
}
Sorry for such a noob question.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

jiggleslupiniv59 reputationPosted Feb 29, 2004, 7:59 PM EST
oblivion_lurksRank #9,026 · 212 reputationPosted Mar 1, 2004, 5:09 PM EST
kovanRank #1,453 · 1.1K reputationPosted Mar 2, 2004, 6:17 PM EST
andrewRank #6,347 · 269 reputationPosted Mar 3, 2004, 7:04 AM EST