Q:

How to sort a list using my own logic (not alphabetically or numerically)

I've spent the last 30 mins looking through existing answers for what I think is a common question, but nothing quite hits it for me. Apologies if this is a dupe.
I've got a list of objects.
List<Journey> journeys;

The object has a 'status' property - this is a string.
class Journey
{
    public string Name;
    public string Status; 
}

I want to sort based on this string, however not alphabetically. The status depicts the object's position through a journey, either "Enroute", "Finished", or "Error". When sorted ascending I want them to appear in the following order: "Error", "Enroute", "Finished". (In practice there are more statuses than this so renaming them to fall in alphabetical order isn't an option)
Aside from creating a class for 'status' with value and sort order properties, and then sorting based on that, how do I do this? Or is that the best method?

A:

You can define the you sorting logic inside of custom function which is provided to Comparison delegate:    
List<Journey> list = new List<Journey>();

list.Sort(new Comparison<Journey>((Journey source, Journey compare) => 
{ 
    // here is my custom compare logic
    return // -1, 0 or 1
}));

