/// <summary> /// Sorts the scalars. /// </summary> private void SortScalars() { IList <IDataListItemModel> newScalarCollection = ScalarCollection.OrderBy(c => c.DisplayName).Where(c => !c.IsBlank).ToList(); ScalarCollection.Clear(); foreach (IDataListItemModel item in newScalarCollection) { ScalarCollection.Add(item); } ScalarCollection.Add(DataListItemModelFactory.CreateDataListModel(string.Empty)); }
/// <summary> /// Sorts the scalars. /// </summary> private void SortScalars(bool ascending) { IList <IDataListItemModel> newScalarCollection; if (ascending) { newScalarCollection = ScalarCollection.OrderBy(c => c.DisplayName) .Where(c => !c.IsBlank).ToList(); } else { newScalarCollection = ScalarCollection.OrderByDescending(c => c.DisplayName) .Where(c => !c.IsBlank).ToList(); } ScalarCollection.Clear(); foreach (var item in newScalarCollection) { ScalarCollection.Add(item); } ScalarCollection.Add(DataListItemModelFactory.CreateDataListModel(string.Empty)); }