示例#1
0
        public ComponentPropertyDescriptor(PropertyDescriptor property)
            : base(property.Name, null)
        {
            _componentType = property.ComponentType;
            _isReadOnly    = property.IsReadOnly;
            _propertyType  = property.PropertyType;
            PropertyInfo propertyInfo = ComponentOperator.GetPropertyInfo(property);

            if (propertyInfo != null)
            {
                _getter = new Lazy <Getter>(() => ComponentOperator.GetPropertyGetter(_componentType, propertyInfo));
                _setter = new Lazy <Setter>(() => ComponentOperator.GetPropertySetter(_componentType, _propertyType, propertyInfo));
            }
            else
            {
                _getter = new Lazy <Getter>(() => ComponentOperator.GetPropertyGetter(_componentType, this.Name));
                _setter = new Lazy <Setter>(() => ComponentOperator.GetPropertySetter(_componentType, _propertyType, this.Name));
            }
        }