-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
The currently released version (2.1.0), currently casts enums to int when fetching possible values, to be able to compare the string representation.
This fails with short or long backed enums with an InvalidCastException.
This could be fixed by using Convert.ToInt32 instead. But I wonder if this is the right approach at all? I would have expected that the ExistsIn attribute refers to a property that has the same type as the target property. If I'm interpreting the code correctly, the following code would fail:
[ExistsIn("Values", "Key", "Value")]
public MyEnum Property {get;set;}
public Dictionary<MyEnum,string> Values = ...;Because only the values fetched from Values are converted to int, but the Property value is not.