diff --git a/src/LinqRb/Extensions/IEnumerable.cs b/src/LinqRb/Extensions/IEnumerable.cs
index 2882e6e..f17f733 100644
--- a/src/LinqRb/Extensions/IEnumerable.cs
+++ b/src/LinqRb/Extensions/IEnumerable.cs
@@ -13,9 +13,9 @@ namespace System.Linq
///
public static IEnumerable Reject(this IEnumerable source, Func predicate)
{
- foreach (T element in source)
+ foreach(T element in source)
{
- if (!predicate(element)) yield return element;
+ if(!predicate(element)) yield return element;
}
}
@@ -28,10 +28,10 @@ namespace System.Linq
{
var enumerator = source.GetEnumerator();
var arr = new List(chunkSize);
- while (enumerator.MoveNext())
+ while(enumerator.MoveNext())
{
arr.Add(enumerator.Current);
- if (arr.Count >= chunkSize)
+ if(arr.Count >= chunkSize)
{
yield return arr;
arr = new List(chunkSize);
@@ -50,12 +50,12 @@ namespace System.Linq
public static IEnumerable AssocFirstOrDefault(this IEnumerable> source, T obj)
{
var outer = source.GetEnumerator();
- while (outer.MoveNext())
+ while(outer.MoveNext())
{
var inner = outer.Current.GetEnumerator();
- while (inner.MoveNext())
+ while(inner.MoveNext())
{
- if (inner.Current.Equals(obj))
+ if(inner.Current.Equals(obj))
{
return outer.Current;
}
@@ -73,9 +73,9 @@ namespace System.Linq
public static IEnumerable Compact(this IEnumerable source)
where T : class
{
- foreach (var item in source)
+ foreach(var item in source)
{
- if (item != null)
+ if(item != null)
{
yield return item;
}
@@ -91,7 +91,7 @@ namespace System.Linq
/// Times we should enumerate over the array
public static void Cycle(this IEnumerable source, Action action, int times)
{
- for (int i = 0; i < times; i++)
+ for(int i = 0; i < times; i++)
{
Enumerate(source, action);
}
@@ -105,24 +105,25 @@ namespace System.Linq
///
public static void Cycle(this IEnumerable source, Action action)
{
- while (true)
+ while(true)
{
Enumerate(source, action);
}
}
- public static void ForEach(this IEnumerable source, Action action)
+ public static IEnumerable ForEach(this IEnumerable source, Action action)
{
- Enumerate(source, action);
+ return Enumerate(source, action);
}
- public static void ForEach(this IEnumerable source, Action action)
+ public static IEnumerable ForEach(this IEnumerable source, Action action)
{
var index = 0;
var enumerator = source.GetEnumerator();
- while (enumerator.MoveNext())
+ while(enumerator.MoveNext())
{
action?.Invoke(enumerator.Current, index);
+ yield return enumerator.Current;
index++;
}
}
@@ -130,10 +131,10 @@ namespace System.Linq
public static IEnumerable Distinct(this IEnumerable source, Func comparer)
{
var items = new HashSet