Ejemplo n.º 1
0
        /// <summary>
        /// 属性
        /// </summary>
        /// <param name="property">属性</param>
        /// <exception cref="ArgumentException"></exception>
        private Property(PropertyInfo property)
        {
            if (property == null)
            {
                throw new ArgumentNullException();
            }

            this.Source     = property;
            this.Name       = property.Name;
            this.ValidRules = this.GetValidRules(property);
            this.getter     = MethodReflection.CreateInvoker(property.GetGetMethod());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 属性
        /// </summary>
        /// <param name="property">属性</param>
        /// <exception cref="ArgumentException"></exception>
        public Property(PropertyInfo property)
        {
            if (property == null)
            {
                throw new ArgumentNullException();
            }

            this.Name       = property.Name;
            this.Source     = property;
            this.ValidRules = GetValidRules(property);

            if (property.CanRead == true)
            {
                this.getter = MethodReflection.CreateInvoker(property.GetGetMethod());
            }
            if (property.CanWrite == true)
            {
                this.setter = MethodReflection.CreateInvoker(property.GetSetMethod());
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 属性的Setter
 /// </summary>
 /// <param name="property">属性</param>
 public PropertySetter(PropertyInfo property)
 {
     this.methodInvoker = MethodReflection.CreateInvoker(property.GetSetMethod());
     this.Name          = property.Name;
     this.Type          = property.PropertyType;
 }