Given the C # enumeration:
public enum stuffEnum: int { New = 0, Old = 1, Fresh = 2 }
How can I scroll it so that I can copy both the key and its value in one cycle? Something like:
foreach(var item in stuffEnum) { NewObject thing = new NewObject{ Name = item.Key, Number = item.Value } }
Thus, you will have 3 objects, their Name properties are set to "New", "Old" and "Fresh", and the "Number" properties are 0, 1 and 2.
How to do it?
c #
ohyeah
source share