Define the IComparable feature and create the comparison feature inside the class:
public class Component : IComparable<component>
{
private string PartNumber;
...
public int CompareTo(Component toSort)
{
return PartNumber.CompareTo(toSort.PartNumber)
}
...
}
</component>
Usage:
private void ListSort(list<component> _list2Sort)
{
_list2Sort.Sort();
}
</component>