Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }