コード例 #1
0
ファイル: AnnotationService.cs プロジェクト: janeth182/ISIL
            public override PropertyDescriptorCollection GetProperties()
            {
                List <PropertyDescriptor> properties = new List <PropertyDescriptor>();

                foreach (PropertyDescriptor metadataProperty in TypeDescriptor.GetProperties(metadataType))
                {
                    PropertyDescriptor original = null;
                    if (originalProperties.TryGetValue(metadataProperty.Name, out original))
                    {
                        IEnumerable <Attribute>     metadata    = metadataProperty.Attributes.OfType <Attribute>();
                        AnnotatedPropertyDescriptor newProperty = new AnnotatedPropertyDescriptor(original, metadata);

                        properties.Add(newProperty);
                    }
                }

                var originalPropertiesWithoutCounterPart = originalProperties.Where(x => !properties.Select(y => y.Name).Contains(x.Key)).Select(x => x.Value);

                properties.AddRange(originalPropertiesWithoutCounterPart);

                return(new PropertyDescriptorCollection(properties.ToArray()));
            }
コード例 #2
0
            public override PropertyDescriptorCollection GetProperties()
            {
                List<PropertyDescriptor> properties = new List<PropertyDescriptor>();

                foreach (PropertyDescriptor metadataProperty in TypeDescriptor.GetProperties(metadataType))
                {
                    PropertyDescriptor original = null;
                    if (originalProperties.TryGetValue(metadataProperty.Name, out original))
                    {
                        IEnumerable<Attribute> metadata = metadataProperty.Attributes.OfType<Attribute>();
                        AnnotatedPropertyDescriptor newProperty = new AnnotatedPropertyDescriptor(original, metadata);

                        properties.Add(newProperty);
                    }
                }

                var originalPropertiesWithoutCounterPart = originalProperties.Where(x => !properties.Select(y => y.Name).Contains(x.Key)).Select(x => x.Value);
                properties.AddRange(originalPropertiesWithoutCounterPart);

                return new PropertyDescriptorCollection(properties.ToArray());
            }