List<string> data = new List<string>();
data.Add("Hold");
data.Add("Hold");
data.Add("Buy");
data.Add("Buy");
data.Add("Hold");
var g = data.GroupBy(i => i);
foreach (var grp in g)
{
Console.WriteLine("{0} {1}", grp.Key, grp.Count());
}
I have done the job this way but i want to return max & min occurrence of the word from the list of word using LINQ.
what will happen if two word has same number of occurrence....then which word name will be returned?
please share right LINQ query. thanks