c# - ALL or null with enums? -
c# - ALL or null with enums? -
i've noticed i've been doing inconsistently within same project. in places, i'll have enum option, , in others i'll have enum nullable type null value indicating (or no filter.)
i noticed when had write if (region != null && part != regions.all)
.
is there reason go 1 way or other?
where enums need specify either "all" or "null" type, go flag
attribute , utilize bitwise &
, |
. much more flexible solution.
as making nullable type or having 1 alternative "all", think if makes sense you, see no problem it. prefer using flags.
c# enums null
Comments
Post a Comment