I have an enum. I'm binding values to the combo. But I should get the values based on an attribute as below? How can I do this?
combo1.DataSource = Enum.GetValues(typeof(AnimalType)).Where(Attribute["IsWild"] = true);
public class AnimalEnum : XmlEnumAttribute{ public bool IsWild { set; get; } } public enum AnilmalType { [AnimalEnum(Name = "Dog", IsWild = false)] Dog, [AnimalEnum(Name = "Cat", IsWild = false)] Cat, [AnimalEnum(Name = "Tiger", IsWild = true)] Tiger, [AnimalEnum(Name = "Lion", IsWild = true)] Lion }
Your help is greatly appreciated.
Sunil