Given the following enum:
Enum enumExample
world
oblivion
holiday
End Enum
I can add its values to a list of ComboBox items like this:
combo.Items.Add(enumExample.holiday)
combo.Items.Add(enumExample.oblivion)
combo.Items.Add(enumExample.world)
Is there a shorter way?
You can use
Enum.GetValuesto get a list of values for an enum then iterate the result:Or, as mentioned by @Styxxy: