I have a master list of colors:
List<string> completeList = new List<string>{"red", "blue", "green", "purple"};
I'm passing in a List开发者_JAVA百科 of existing colors of a product
List<string> actualColors = new List<string>{"blue", "red", "green"};
How do I get a list back that is in the order of the completeList? (red,blue,green)
var ordered = completeList.Intersect(actualColors);
If that doesn't work, do this
var ordered = actualColors.Intersect(completeList);
精彩评论