CodeHaacks
CodeHaacks copied to clipboard
GetArgumentValue in AttributeExtensions can not handle enums
First and foremost, well done and good post i stumbled on youre old post from 2010 👍 "http://haacked.com/archive/2010/08/05/copying-attributes.aspx/" and wanted to pitch in for an update for enums.
To fix proper handlings of enum for a constructors replace:
var value = argument.Value; with
object value;
if (argument.ArgumentType.IsEnum)
{
value = Enum.ToObject(argument.ArgumentType, argument.Value);
}
else
{
value = argument.Value;
}
Why don't you submit that as a Pull Request? :smile:
@Haacked done :)