The test is only for string. This prevents adding int and decimal et al directly without using "ToString()".
If you change your add method to test for type.IsValueType this can be facilitated:
(From line 29)
foreach (var arg in args)
{
if (arg is string)
value = arg as string;
else
{
var t = arg.GetType();
if (t.IsValueType)
{
value = arg.ToString();
}
else
{
foreach (var prop in arg.GetType().GetProperties())
{
attributes.Add(prop.Name, prop.GetValue(arg, null) as string);
}
}
}
}