コード例 #1
0
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            if (this.GetClassView() == null)
            {
                return(TypeDescriptor.GetProperties(this.obj, attributes));
            }

            if (properties == null)
            {
                PropertyDescriptorCollection realPropertyDescriptors = TypeDescriptor.GetProperties(this.obj, attributes, true);

                PropertyDescriptor[] wrappedProperties = new PropertyDescriptor[this.GetClassView().PropertyViews.Count];

                int i = 0;
                foreach (PropertyView propertyView in this.GetClassView().PropertyViews)
                {
                    foreach (PropertyDescriptor realPropertyDescriptor in realPropertyDescriptors)
                    {
                        //TODO: fix real property path traversal...
                        if (realPropertyDescriptor.Name.Equals(propertyView.Path))
                        {
                            wrappedProperties[i] = new WrappedProperty(realPropertyDescriptor, propertyView, attributes);
                            i++;
                            break;
                        }
                    }
                }

                properties = new PropertyDescriptorCollection(wrappedProperties);
            }

            return(properties);
        }
コード例 #2
0
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            if (this.GetClassView() == null)

                return TypeDescriptor.GetProperties(this.obj, attributes);

            if (properties == null)
            {
                PropertyDescriptorCollection realPropertyDescriptors = TypeDescriptor.GetProperties(this.obj, attributes, true);

                PropertyDescriptor[] wrappedProperties = new PropertyDescriptor[this.GetClassView().PropertyViews.Count];

                int i = 0;
                foreach (PropertyView propertyView in this.GetClassView().PropertyViews)
                {
                    foreach (PropertyDescriptor realPropertyDescriptor in realPropertyDescriptors)
                    {
                        //TODO: fix real property path traversal...
                        if (realPropertyDescriptor.Name.Equals(propertyView.Path))
                        {
                            wrappedProperties[i] = new WrappedProperty(realPropertyDescriptor, propertyView, attributes);
                            i++;
                            break;
                        }
                    }
                }

                properties = new PropertyDescriptorCollection(wrappedProperties);
            }

            return properties;
        }