Esempio n. 1
0
        /// <summary>
        /// Creates a new instance of <see cref="DynamicAccessor"/>
        /// </summary>
        protected DynamicAccessor(MemberInfo memberInfo, DynamicSetter setter, DynamicGetter getter, Type valueType, AccessorTypes accessorType) : base(memberInfo)
        {
            ValueType    = valueType ?? throw new ArgumentNullException(nameof(valueType));
            AccessorType = accessorType;
            var accessMode = ValueAccessModes.None;

            if (getter != null)
            {
                Getter      = getter;
                accessMode |= ValueAccessModes.Read;
            }
            if (setter != null)
            {
                Setter      = setter;
                accessMode |= ValueAccessModes.Write;
            }
            ValueAccessMode = accessMode;
        }
Esempio n. 2
0
 internal DynamicField(FieldInfo fieldInfo, DynamicGetter getter, DynamicSetter setter) :
     base(fieldInfo, setter, getter, fieldInfo.FieldType, AccessorTypes.Field)
 {
     FieldInfo = fieldInfo;
 }
Esempio n. 3
0
 internal DynamicProperty(PropertyInfo propertyInfo, DynamicGetter getter, DynamicSetter setter) :
     base(propertyInfo, setter, getter, propertyInfo.PropertyType, AccessorTypes.Field)
 {
     PropertyInfo = propertyInfo;
 }