using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Core.Common.Utils.Extensions { public static class EnumerableExtensions { public static void ForEachElementDo(this IEnumerable source, Action action) { foreach (var item in source) { action(item); } } /// /// Returns the number of elements in a sequence. /// /// A sequence that contains elements to be counted. /// The number of elements in the input sequence. /// source is null. /// The number of elements in source is larger than /// public static int Count(this IEnumerable source) { return Enumerable.Count(source.Cast()); } } }