internal PropertyDescriptorCollection FilterProperties(object component, Attribute[] attributes, PropertyDescriptorCollection properties) {
PropertyDescriptorCollection filteredProperties = properties;
ArrayList allProps = null;
if (component is IComponent) {
ITypeDescriptorFilterService tf = (ITypeDescriptorFilterService)GetService(component, typeof(ITypeDescriptorFilterService));
if (tf != null) {
Hashtable filterTable = new Hashtable(properties.Count);
foreach(PropertyDescriptor p in properties) {
string suffix = GetExtenderCollisionSuffix(p);
if (suffix == null)
suffix = "";
Debug.Assert(!filterTable.Contains(p.Name + suffix), "Overwriting PropertyDescriptor during filtering!!! " + p.Name + suffix);
filterTable[p.Name + suffix] = p;
}
tf.FilterProperties((IComponent)component, filterTable);
allProps = new ArrayList(filterTable.Values);
}
}
if (attributes != null && attributes.Length > 0) {
if (allProps == null) {
allProps = new ArrayList(properties);
}
FilterMembers(typeof(PropertyDescriptor), allProps, attributes);
}
if (allProps != null) {
PropertyDescriptor[] temp = new PropertyDescriptor[allProps.Count];
allProps.CopyTo(temp, 0);
filteredProperties = new PropertyDescriptorCollection(temp, true);
}
return filteredProperties;
}