I suggest you ...

Using Boolean(bool) as the "enum" Underlying Type

In the C# and CLR the underlying type of an enum can be any integral type. If the bool(Boolean) type is used, the true/false aliases will be available specially in the ORM classes (for bit datatype).

For example:
public enum Gender : bool
{
Male,
Female
}

or

public enum Answer : bool
{
No = false,
Yes = true
}

and then:

Answer ans = Answer.Yes;
if(ans){
...
}

35 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base