master
1using System;
2using System.Collections.Generic;
3
4namespace Notepad.Infrastructure.Extensions {
5 public static class EnumerableExtensions {
6 public static void Walk<T>(this IEnumerable<T> itemsToWalk) {
7 foreach (var item in itemsToWalk) {}
8 }
9
10 public static IEnumerable<T> ThatSatisfy<T>(this IEnumerable<T> itemsToPeekInto, Predicate<T> criteriaToSatisfy) {
11 foreach (var item in itemsToPeekInto) {
12 if (item.Satisfies(criteriaToSatisfy)) {
13 yield return item;
14 }
15 }
16 }
17
18 public static IEnumerable<T> SortedUsing<T>(this IEnumerable<T> itemsToSort, IComparer<T> sortingAlgorithm) {
19 var sortedItems = new List<T>(itemsToSort);
20 sortedItems.Sort(sortingAlgorithm);
21 return sortedItems;
22 }
23 }
24}