Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyAccessor"/> class
        /// </summary>
        /// <param name="property">The property to build accessor for</param>
        public PropertyAccessor(PropertyInfo property)
        {
            Precondition.Require(property, () => Error.ArgumentNull("property"));

            if (property.GetIndexParameters().Length > 0)
            {
                throw Error.CouldNotCreateAccessorForIndexedProperty(property);
            }

            _property = property;
            _accessor = CreateAccessor(property);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldAccessor"/> class
 /// </summary>
 /// <param name="field">The field to build accessor for</param>
 public FieldAccessor(FieldInfo field)
 {
     Precondition.Require(field, () => Error.ArgumentNull("field"));
     _field    = field;
     _accessor = CreateAccessor(field);
 }