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())); }
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()); }