I have a List of key value pairs which I would like to sort according to an order specified in another array.
var requiredOrder = new String[] { "PH", "HH", "PR", "SR", "UN", "UD", "WD", "WE", "OT" };
var listToBeSorted = new List<KeyValuePair<string, string>>() {
new KeyValuePair<string, string>("A","PR"),
new KeyValuePair<string, string>("B","PH"),
new KeyValuePair<string, string>("C","HH"),
new KeyValuePair<string, string>("D","WD"),
new KeyValuePair<string, string>("E","OT"),
new KeyValuePair<string, string>("F","UN"),
.....
};
'listToBeSorted' is a really a collection I fetch for a dropdownlist that needs to be sorted by value according to the 'requiredOrder' array.