I have some enums which i have set up as follows:
public enum MyDefaultEnums
{
[EnumMember(Value="My First Enum")]enum1,
[EnumMember(Value="My Second Enum")]enum2,
}
Then I run a method which checks a given textbox (tb) to see what text is in it. If the value is there in the enum list, it clears it, if it isn't, it leaves it alone:
if (Enum.IsDefined(typeof(MyDefaultEnums), tb.Text) == true)
{
tb.Text = "";
}
However, its not working. Debugging at runtime shows me that MyDefaultEnums is picking the values up as enum1 and enum2, instead of the strings i put in there. Can anyone point me to where im going wrong? Thanks