I currently have a List<string> object that stores following HTML strings, mainly the URLs, e.g.
List[0] = "<a href='#' id='1'>Banana</a>";
List[1] = "<a href='#' id='2'>Orange</a>";
List[2] = "<a href='#' id='3'>Apple</a>";
List[3] = "<a href='#' id='4'>Mango</a>";
...
And, when I sort the List<string> object, by doing URLList.Sort(); (assume thatURLListobject has been instantiated.), it gives such order, Banana=>Orange=>Apple=>Mango, which is not exactly what I wanted.
I’d like to have it sorted based on the alphabetical order of these fruit, which is like Apple=>Banana=>Mango=>Orange.
So how can I achieve this custom sorting? Any suggestions? Thanks.
If you want a simple way of doing it, and you expect your array to not change too much:
EDITED 11/30/2012