Skip to content

Commit

Permalink
# Fixing assigning enum values to action's properties
Browse files Browse the repository at this point in the history
  • Loading branch information
maurok committed May 18, 2017
1 parent f5179c3 commit e557fd0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,16 @@ private static bool AssignValue(ILuisAction action, PropertyInfo property, objec

try
{
var value = Convert.ChangeType(paramValue, type);
property.SetValue(action, value);
if (type.IsEnum)
{
property.SetValue(action, Enum.Parse(type, (string)paramValue));
}
else
{
var value = Convert.ChangeType(paramValue, type);
property.SetValue(action, value);
}

return true;
}
catch (FormatException)
Expand Down

0 comments on commit e557fd0

Please sign in to comment.