protected bool SetProperty(object instance, string name, object value)
{
if (instance == null)
instance = this;
var miArray = InstanceType.GetMember(name, BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.Instance);
if (miArray != null && miArray.Length > 0)
{
var mi = miArray[0];
if (mi.MemberType == MemberTypes.Property)
{
((PropertyInfo)mi).SetValue(Instance, value, null);
return true;
}
}
return false;
}