protected static List <T> SortedCollection <T> (SPListItemCollection items, ListSortType sortType, List <Vote> votes, Func <SPListItem, List <Vote>, T> factory) where T : IVotable { var returnlist = new List <T>(); Type genericType = typeof(T); for (int i = 0; i < items.Count; i++) { returnlist.Add(factory(items[i], votes)); } // etc. }
public void SortTaskBy(ListSortType sortField) { this.ParentList.SortBy = sortField; // Sort the list according to the new sorting order to update the UI SetTasksforList(); // Update list in db and synchronize update to persist sorting direction //this.ListService.ListUpdate(this.ParentList); this._syncService.SendUpdate(new SyncMessage { Type = UpdateType.Update, Timestamp = DateTime.Now, Data = new ListItemUpdate() { Item = this.ParentList } }); }
public static List <ChildClass> SortedCollection (SPListItemCollection items, ListSortType sortType, List <Vote> votes) { return(SCO.SortedCollection <ChildClass>( items, sortType, votes, (i, vs) => new ChildClass(i, vs))); }