Enum value conversion from int
Issue #86
resolved
When working with a Dropdown int provider and a context data updater with an enum DataBound value the ReflectionUtils.TryConvertValue() fails to convert the rawValue from int.
I have it working at my end by updating a part of the function in the following way:
// Try convert enum.
if (TypeInfoUtils.IsEnum(type))
{
if (rawValue is string)
{
convertedValue = Enum.Parse(type, (string)rawValue);
return true;
}
if (rawValue is int)
{
convertedValue = Enum.ToObject(type, rawValue);
return true;
}
}
Comments (3)
-
repo owner -
repo owner - changed status to resolved
Added to 1.15
-
reporter great! thanks!
- Log in to comment
Great, thanks for your contribution. I don't see any reasons to not include it in the next version :)