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
Post a Comment