public class Person { public string FirstName{set;get;} public string LastName{set;get;} public Person(){} public Person(string firstName, string last... ...
public class Person { public string FirstName{set;get;} public string LastName{set;get;} public Person(){} public Person(string firstName, string lastName) { FirstName = firstName; LastName = lastName; } } List<Person> personList=new List<Person>(); personList.Add(new Person() { FirstName = "Mickey", LastName = "Mouse" }); personList.Add(new Person() { FirstName = "Mickey", LastName = "Mouse" }); personList.Add(new Person() { FirstName = "zhang", LastName = "san" }); string columnName="FirstName"; var dics=personList.GroupBy(x => GetPropertyValue(x, columnName)).ToDictionary(x=>x.Key,x=>x.Count()); foreach(var dic in dics) { textBox1.AppendText(string.Format("{0},{1}\r\n",dic.Key,dic.Value)); }