I have a list of string arrays, where the arrays are formatted as [Animal, Breed, Name]:
{ ["Dog", "Golden Retriever", "Rex"],
["Cat", "Tabby", "Boblawblah"],
["Fish", "Clown", "Nemo"],
["Dog", "Pug", "Daisy"],
["Cat", "Siemese", "Wednesday"],
["Fish", "Gold", "Alaska"]
}
How would I sort this list so that it was arranged alphabetically by "Animal", and then "Breed"? i.e.:
{ ["Cat", "Siamese", "Boblawblah"],
["Cat", "Tabby", "Wednesday"],
["Dog", "Golden Retriever", "Rex"],
["Dog", "Pug", "Daisy"],
["Fish", "Clown", "Nemo"],
["Fish", "Gold", "Alaska"]
}
I am currently trying:
animalList.Sort((s, t) => String.Compare(s[0], t[0]));
But that is not sorting the second column correctly. In addition to sorting by the first two columns alphabetically, how would I then add in the third column?