public List<AlphaIndex> Generate(List<Contact> values, GetAlphaMehtod extractName) { var data = from q in values where extractName(q) != null group q by extractName(q) into g orderby g.Key select new AlphaIndex() { Index = g.Key, Count = g.Count() }; var res = data.ToList(); res.Insert(0, AlphaIndex.All); return res; }
public List<AlphaIndex> Generate(List<UserInfo> values, GetAlphaMehtod extractName) { var data = from q in values where extractName(q) != null group q by extractName(q) into g orderby g.Key select new AlphaIndex() { Index = g.Key, Count = g.Count() }; var res = data.ToList(); res.Insert(0, AlphaIndex.All); return res; }