c# - enum to comboBox except some of enum elements -


for example have enum:

private enum categories { foo, foobar, bar } 

at way fill combobox elements of enum:

mycombobox.itemssource = enum.getvalues(typeof(categories)).cast<categories>(); 

but how bind enum elements except categories.foobar example?

you can use where:

enum.getvalues(typeof(categories))       .cast<categories>()       .where(x => x != categories.foobar).tolist(); 

Comments

Popular posts from this blog

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

matplotlib - PYTHON: Annotate boxes disapear dependant on range -