public static object SetProperty(object target, string name, object value)
{
IQuackFu duck = target as IQuackFu;
if (null != duck) return duck.QuackSet(name, null, value);
Type type = target as Type;
if (null == type)
{
target.GetType().InvokeMember(name,
ResolveFlagsToUse(target.GetType(), SetPropertyBindingFlags),
null,
target,
new object[] {value});
}
else
{
// static member
type.InvokeMember(name,
SetPropertyBindingFlags,
null,
null,
new object[] {value});
}
return value;
}