When inheriting from an ExpandableObjectConverter to display custom properties in a PropertyGrid, you will often want to set the order of the properties instead of having them in alphabetical order.
To do this you just need to override the GetProperties method. Call the Sort function on the PropertyDescriptorCollection object returned by the base function, passing an array of strings with the property names in the order that you desire.
For example:
public override PropertyDescriptorCollection
GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return base.GetProperties(context, value, attributes)
.Sort(new string[] { "Name", "Street", "City", "Country" });
}
Any properties not in the string array will be added on afterwards in alphabetical order.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.