12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Wayne.Lib
- {
-
-
-
- public static class EnumerableExtensions
- {
-
-
-
-
-
-
- public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
- {
- foreach (var item in enumerable)
- {
- action(item);
- }
- }
-
-
-
-
-
-
-
-
- public static bool IsIn<T>(this T value, params T[] values)
- {
- return values.Contains(value);
- }
-
-
-
-
-
-
- public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> enumerable)
- {
- if (enumerable == null)
- return new T[] {};
- return enumerable.Where(x=> x != null);
- }
- }
- }
|