Enum value conversion from int

Issue #86 resolved
Sameer Mirza created an issue

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)

  1. Christian Oeing repo owner

    Great, thanks for your contribution. I don't see any reasons to not include it in the next version :)

  2. Log in to comment