works well under windows but not under javascript (beta 5) :
Code: Select all
public override ValueType ConvertFromString( string input, Type toType )
{
if (toType.IsEnum)
#if CSHTML5
{
var vals = Enum.GetValues(toType);
int i = 0;
foreach (var val in vals)
{
if (val.ToString() == input)
{
return val as ValueType;
}
i++;
}
throw new ArgumentException("ENum value not found " + input + " in " + toType.ToString());
}
#else
return (Enum.Parse(toType, input, false)) as ValueType;
#endif
}
the cast destroys the enum type ...
If I move to code to the calling function, it works ...
Reagards, Uwe