❔ Nullable enums or None inside
Suppose there are some known tasks like Carry, Build, etc.
A worker can be idle or busy. If they are busy, a task is assigned to them.
Which one do you prefer to define task types?
Imo, The second one
6 Replies
Because I can iterate over or store tasks using tasktype
for example in dictionary
If
None
is supposed to be the "default", then it should be 0, because then default(TaskType)
will be None
OK, yes
The enum value that is 0 is always the default
I have a list/priority queue for each task type
yes
If I include None inside, I have trouble, in many situations I should ignore None
Dictionary<TaskType,PriorityQueue<>>
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.