I am lately starting a project and I have a question.
Let's say I am dealing with a class Person
, and a person can have one(or more) deseases he is encountering.
so I have created an enum :
public enum diseases{headache,throat,bruise,gunshot,none}; // enum containing all the diseases
public diseases disease;
And further in code I set a certain disease
to that person and it works fine.
Thing is, there might be a point in my project where a person might have 2 diseases. So there are my questions:
- Is using enum the best option here? I want my code to be organized and understood and that's a main reason for using enums.
- If using enum is a good option, I have managed to combine this enum with bit-flags(using
[System.Flags]
) so when time comes I can check for adisease
that contains two different values from the enum. is this a good approach? - If using enum is a good option, should I just create a second property from
diseases
(just like I createddisease
) and save all the trouble from using bit-flags?
Thanks in advance for any light on that matter, couldn't figure what was the best approach here.