public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { var originalProperties = TypeDescriptor.GetProperties(this, true); var originalArray = new PropertyDescriptor[originalProperties.Count]; originalProperties.CopyTo(originalArray, 0); var result = new PropertyDescriptorCollection(originalArray, false); foreach (PropertyDescriptor descriptor in originalProperties) { if (descriptor.Name == TestPropertyPropertyName) { var newDescriptor = new TestPropertyDescriptor( descriptor.Name + PropertyNameSuffix, typeof(string), descriptor); result.Add(newDescriptor); } else { result.Add(descriptor); } } return(result); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { var originalProperties = TypeDescriptor.GetProperties(this, true); var originalArray = new PropertyDescriptor[originalProperties.Count]; originalProperties.CopyTo(originalArray, 0); var result = new PropertyDescriptorCollection(originalArray, false); foreach (PropertyDescriptor descriptor in originalProperties) { if (descriptor.Name == TestPropertyPropertyName) { var newDescriptor = new TestPropertyDescriptor( descriptor.Name + PropertyNameSuffix, typeof(string), descriptor); result.Add(newDescriptor); } else { result.Add(descriptor); } } return result; }