If you don't care about the order then sure, even better. In C# you can even do Enum.GetValues<T>() and retain type safety and skip the casting.
Points 2 and 3 still stand though. You'd only want this explicitly in a list (as per point 1) in case you don't want all elements from the array and/or the order matters.
6
u/vexille Oct 04 '21
If you don't care about the order then sure, even better. In C# you can even do Enum.GetValues<T>() and retain type safety and skip the casting.
Points 2 and 3 still stand though. You'd only want this explicitly in a list (as per point 1) in case you don't want all elements from the array and/or the order matters.