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

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -