protected void InitIndex(List<Contact> list) { this.extractName = (s) => { string name = ((Contact)s).LastName; if(string.IsNullOrEmpty(name)) return null; //todo? return AlphaIndex.Group(name.Substring(0, 1)); }; List<AlphaIndex> dict = Generate(list, extractName); SetupGrid(dict, indexGridControl); }
IList ApplyFilter(List<Contact> list, AlphaIndex alpha) { if(alpha == AlphaIndex.All || alpha == null) return list; return list.Where(c => alpha.Match(AlphaIndex.Group(c.LastName))).ToList(); }
protected void InitIndex(List<Contact> list) { SetupGrid(Generate(list, c => AlphaIndex.Group(c.LastName)), indexGridControl); }