How to determine if a bool variable has not been assigned a value?

Feb 29 2004 11:30 PM
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.

Answers (4)