}//---метод Inverse #endregion #region Async ListExt /* * [NonSerialized] * private AsyncOperation asyncOp = null; * * private void CreateAsyncOp() * { * // Create the AsyncOperation to post events on the creator thread * asyncOp = AsyncOperationManager.CreateOperation(null); * } * * protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) * { * // Post the CollectionChanged event on the creator thread * asyncOp.Post(RaiseCollectionChanged, e); * } * * private void RaiseCollectionChanged(object param) * { * // We are in the creator thread, call the base implementation directly * base.OnCollectionChanged((NotifyCollectionChangedEventArgs)param); * } * * protected override void OnPropertyChanged(PropertyChangedEventArgs e) * { * // Post the PropertyChanged event on the creator thread * asyncOp.Post(RaisePropertyChanged, e); * } * * private void RaisePropertyChanged(object param) * { * // We are in the creator thread, call the base implementation directly * base.OnPropertyChanged((PropertyChangedEventArgs)param); * }*/ #endregion #region Статические методы /// <summary> /// Инвертирует полученную коллекцию /// </summary> /// <param name="collection">Принимает коллекцию</param> /// <returns>Возвращает инвертированную коллекцию</returns> public static T[] Inverse(IEnumerable <T> collection) { ListExt <T> tmp_send = new ListExt <T>(); for (int i = collection.Count() - 1; i >= 0; i--) { tmp_send.Add(collection.ElementAt(i)); } return(tmp_send.ToArray()); } //---метод Inverse
} //---метод Inverse /// <summary> /// Возвращает коллекцию, соответствующую указанному условию. /// </summary> /// <param name="collection">Коллекция для проверки.</param> /// <param name="predicate">Условие для проверки коллекции.</param> /// <returns>Возвращает коллекцию, соответствующую указанному условию.</returns> public static T[] FindRange(IEnumerable <T> collection, Func <T, bool> predicate) { ListExt <T> tmp_send = new ListExt <T>(); foreach (T model in collection) { if (predicate(model)) { tmp_send.Add(model); } } return(tmp_send.ToArray()); }