public PropertyDescriptorCollection GetProperties( Attribute[] attributes ) { PropertyDescriptor[] newProps = new PropertyDescriptor[ this.Count ]; int iResultCount = 0; for( int i = 0; i < this.Count; i++ ) { CustomProperty prop = ( CustomProperty )this[ i ]; if( prop.Visible ) { newProps[ iResultCount ] = new CustomPropertyDescriptor( ref prop, attributes ); ++iResultCount; } } Array.Resize( ref newProps, iResultCount ); newProps = newProps.OrderBy( x => x.DisplayName ).ToArray(); return new PropertyDescriptorCollection( newProps ); }