I have the following class:
class MyClass{
string field1, field2;
}
And I have List<MyClass>
thats contains the following:
list.Add(new MyClass("1","1"));
list.Add(new MyClass("1","2"));
list.Add(new MyClass("1","3"));
list.Add(new MyClass("2","2"));
list.Add(new MyClass("3","2"));
I want to find the most frequent value of field1
, this case I have three times the value "1", one time the value "2" and one time the value "3", How can I get the maximum count value of field1
(this case is "1")?