I want to get the most common string from a list of models using Linq, but I really don't know how to do this.
Here is a sample code:
public ModelClass { public string name { get; set; } public int num { get; set; } }
Imagine a huge list of ModelClass stored in a database
// in some controller var model = from s in _db.SomeClass select s; string mostCommonName = ???????
How can I find the most common name from this list using linq?
source share