I have a perhaps silly question… I am trying to determine what is the best approach for typing a property whose value will be either “New” or “Used”. Do I use an enum or should I just go with a boolean (e.g. IsNew)? If I go with enum, what should I call this type and property name? (public NewOrUsed NewOrUsed {get; set;} <– confusing)
Obviously, with enum I can have state that declares neither value (NONE, NEW, USED) and enum is more future-proof (although one can claim there is no chance other values will exist). Again, what is the appropriate name for such a type and property?
With boolean – it’s pretty straight forward (either using IsNew or IsUsed)
I know it’s silly, but I am curious what others think
Regards
Z..
Update
If you prefer enum, please comment on what should be appropriate name for type and property (e.g public NewUsedType NewOrUsed {get; set;})
You mentioned in a comment “I allready [sic] have a Condition – it refers to a condition when something is Y”Used” (e.g. used vehicle/book can be in “fair”, “like new”, “mint” condition) ;)”
So with that piece of information, I’d definitely go with a
bool. You already have an extensible way of establishing the condition so this is more of a categorical thing. You may some time in the future you may want something whether more than one condition counts as “New” say: