-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Pipe.cs
38 lines (36 loc) · 1.13 KB
/
Pipe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
namespace SuperLinq;
public static partial class SuperEnumerable
{
/// <summary>
/// Lazily invokes an action for each value in the sequence.
/// </summary>
/// <typeparam name="TSource">
/// Source sequence element type.
/// </typeparam>
/// <param name="source">
/// Source sequence.
/// </param>
/// <param name="action">
/// Action to invoke for each element.
/// </param>
/// <returns>
/// Sequence exhibiting the specified side-effects upon enumeration.
/// </returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="source"/> or <paramref name="action"/> is <see langword="null"/>.
/// </exception>
/// <remarks>
/// <para>
/// This method is a synonym for <see cref="Do{TSource}(IEnumerable{TSource}, Action{TSource})"/>.
/// </para>
/// <para>
/// This method uses deferred execution and streams its results.
/// </para>
/// </remarks>
public static IEnumerable<TSource> Pipe<TSource>(this IEnumerable<TSource> source, Action<TSource> action)
{
ArgumentNullException.ThrowIfNull(source);
ArgumentNullException.ThrowIfNull(action);
return Do(source, action);
}
}