Hi,
I am trying to use a custom sort delegate with my List in C#. It seems that the result is not deterministic, in that I have a list of items, all with equal values, but the order of the list is different every time I call the Sort method.
I call the sort function like so:
mGameObjects.Sort(CompareByRenderPriority);
Here is my implementation of the sort:
// Used to sort the game objects based on render priority. We want the higher
// priority (which is a smaller number) to appear later on the list.
//
private static int CompareByRenderPriority(GameObject x, GameObject y)
{
// For testing I just return 0 every time, indicating that the
// 2 items are equal.
return 0;
}
Is there a way to tell the list not to change the order of items have the same value?
Thanks!