using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace AntDesign { public static class EnumerableExtensions { public static void ForEach(this IEnumerable items, Action action) { if (items == null) { return; } foreach (T obj in items) { action(obj); } } public static async Task ForEachAsync(this IEnumerable items, Func func) { if (items == null) { return; } for (int i = 0; i < items.Count(); i++) { await func(items.ElementAt(i)); } } public static bool IsIn(this T source, params T[] array) { return array.Contains(source); } } }