Let's say I have a list of strings like this:
List<string> myList = ["black", "red", "green", "green", "red", "green", "blue"]
I want the return to be group by the string and the count to be how many times it appears in the array, ordered by count:
{
"green": 3 (because there's 3 "greens" in the list
"red": 2
"black" : 1,
"blue" : 1
}
How can I achieve this with LINQ? I've tried groupby's with count's but I'm not getting the right syntax.