I'm writing an application, where I have quite a lot Properties of Type Boolean defined:
private bool kajmak = true;
public bool Kajmak
{
get { return kajmak ; }
set { kajmak = value; FirePropertyChanged(() => Kajmak); }
}
As you see, I set kajmak
to true
at the beginning..-the reason is nonrelevant-. (You might know that the default value of a bool variable is false).
Now, is there a way, to change the default value of a bool
to true
? So I would write:
private bool kajmak; //kajmak = true
instead of
private bool kajmak = true;
What could I do to achieve this?
Because booleans are false by default, I use positive forms in my names, like IsInitialized
, HasSomething
etc. which I want to be false by default until I explicitly set them.
If you find you need something to be true by default, maybe you need to rename your variable so it makes more sense when the default is false.