private bool TrySetProperty(Context context, IValue value, string attrName) { PropertyInfo property = instance.GetType().GetProperty(attrName, bindingFlags); if (property != null) { property.SetValue(instance, value.ConvertTo(context, property.PropertyType), null); } return(property != null); }
private bool TrySetField(Context context, IValue value, string attrName) { FieldInfo field = instance.GetType().GetField(attrName, bindingFlags); if (field != null) { field.SetValue(instance, value.ConvertTo(context, field.FieldType)); } return(field != null); }