1
- {{
2
- $arity = arity
3
- $ordinals = ordinals
4
- $cardinals = cardinals
5
- }}
6
-
1
+ {{~
2
+ $arity = arity
3
+ $ordinals = ordinals
4
+ $cardinals = cardinals
5
+ ~}}
7
6
namespace SuperLinq.Async;
8
7
9
8
#nullable enable
10
9
11
10
public static partial class AsyncSuperEnumerable
12
11
{
13
12
{{~ for $i in 2..4 ~}}
14
- /// <summary>
13
+ /// <summary>
15
14
/// <para>
16
15
/// Applies a specified function to the corresponding elements of {{ $ordinals[$i] }} sequences,
17
16
/// producing a sequence of the results.</para>
18
17
/// <para>
19
18
/// The resulting sequence has the same length as the input sequences.
20
19
/// If the input sequences are of different lengths, an exception is thrown.</para>
21
- /// </summary>
22
- /// <typeparam name="TResult">
23
- /// The type of the elements of the result sequence.</typeparam>
24
- /// <param name="resultSelector">A projection function that combines
25
- /// elements from all of the sequences.</param>
26
- /// <returns>A sequence of elements returned by <paramref name="resultSelector"/>.</returns>
27
- /// <remarks>
28
- /// This method uses deferred execution and stream its results.
29
- /// </remarks>
30
- /// <exception cref="global::System.ArgumentNullException"><paramref name="resultSelector"/> or any of the input sequences is null.</exception>
31
- /// <exception cref="global::System.InvalidOperationException">
20
+ /// </summary>
21
+ /// <typeparam name="TResult">
22
+ /// The type of the elements of the result sequence.</typeparam>
23
+ /// <param name="resultSelector">A projection function that combines
24
+ /// elements from all of the sequences.</param>
25
+ /// <returns>A sequence of elements returned by <paramref name="resultSelector"/>.</returns>
26
+ /// <remarks>
27
+ /// This method uses deferred execution and stream its results.
28
+ /// </remarks>
29
+ /// <exception cref="global::System.ArgumentNullException"><paramref name="resultSelector"/> or any of the input sequences is null.</exception>
30
+ /// <exception cref="global::System.InvalidOperationException">
32
31
/// Any of the input sequences are shorter than the others.
33
32
/// </exception>
34
33
{{~ for $j in 1..$i ~}}
35
- /// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
34
+ /// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
36
35
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
37
36
{{~ end ~}}
38
- public static global::System.Collections.Generic.IAsyncEnumerable<TResult> EquiZip<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult>(this
37
+ public static global::System.Collections.Generic.IAsyncEnumerable<TResult> EquiZip<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult>(this
39
38
{{~ for $j in 1..$i ~}}
40
- global::System.Collections.Generic.IAsyncEnumerable<T{{ $cardinals[$j] }}> {{ $ordinals[$j] }},
39
+ global::System.Collections.Generic.IAsyncEnumerable<T{{ $cardinals[$j] }}> {{ $ordinals[$j] }},
41
40
{{~ end ~}}
42
- global::System.Func<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult> resultSelector)
41
+ global::System.Func<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult> resultSelector
42
+ )
43
43
{
44
44
{{~ for $j in 1..$i ~}}
45
- ArgumentNullException.ThrowIfNull({{ $ordinals[$j] }});
45
+ ArgumentNullException.ThrowIfNull({{ $ordinals[$j] }});
46
46
{{~ end ~}}
47
47
48
- ArgumentNullException.ThrowIfNull(resultSelector);
48
+ ArgumentNullException.ThrowIfNull(resultSelector);
49
49
50
50
return Core(
51
51
{{~ for $j in 1..$i ~}}
52
52
{{ $ordinals[$j] }},
53
53
{{~ end ~}}
54
- resultSelector);
54
+ resultSelector
55
+ );
55
56
56
57
static async global::System.Collections.Generic.IAsyncEnumerable<TResult> Core(
57
58
{{~ for $j in 1..$i ~}}
58
59
global::System.Collections.Generic.IAsyncEnumerable<T{{ $cardinals[$j] }}> {{ $ordinals[$j] }},
59
60
{{~ end ~}}
60
61
global::System.Func<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult> resultSelector,
61
- [EnumeratorCancellation] CancellationToken cancellationToken = default)
62
+ [EnumeratorCancellation] CancellationToken cancellationToken = default
63
+ )
62
64
{
63
65
{{~ for $j in 1..$i ~}}
64
66
await using var e{{ $j }} = {{ $ordinals[$j] }}.ConfigureAwait(false).WithCancellation(cancellationToken).GetAsyncEnumerator();
@@ -75,10 +77,10 @@ public static partial class AsyncSuperEnumerable
75
77
|| await e{{$j}}.MoveNextAsync()
76
78
{{~ end
77
79
end ~}}
78
- )
80
+ )
79
81
{
80
- ThrowHelper.ThrowInvalidOperationException("First sequence too short.");
81
- }
82
+ ThrowHelper.ThrowInvalidOperationException("First sequence too short.");
83
+ }
82
84
83
85
yield break;
84
86
}
@@ -101,26 +103,27 @@ public static partial class AsyncSuperEnumerable
101
103
/// <summary>
102
104
/// Joins the corresponding elements of {{ $ordinals[$i] }} sequences,
103
105
/// producing a sequence of tuples containing them.
104
- /// </summary>
105
- /// <returns>A sequence of
106
+ /// </summary>
107
+ /// <returns>A sequence of
106
108
/// <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" />
107
- /// containing corresponding elements from each of the sequences.</returns>
108
- /// <remarks>
109
- /// This method uses deferred execution and stream its results.
110
- /// </remarks>
111
- /// <exception cref="global::System.ArgumentNullException">Any of the input sequences is null.</exception>
112
- /// <exception cref="global::System.InvalidOperationException">
109
+ /// containing corresponding elements from each of the sequences.</returns>
110
+ /// <remarks>
111
+ /// This method uses deferred execution and stream its results.
112
+ /// </remarks>
113
+ /// <exception cref="global::System.ArgumentNullException">Any of the input sequences is null.</exception>
114
+ /// <exception cref="global::System.InvalidOperationException">
113
115
/// Any of the input sequences are shorter than the others.
114
116
/// </exception>
115
117
{{~ for $j in 1..$i ~}}
116
- /// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
118
+ /// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
117
119
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
118
120
{{~ end ~}}
119
- public static global::System.Collections.Generic.IAsyncEnumerable<({{~ for $j in 1..$i ~}}T{{ $cardinals[$j] }}{{ if !for.last }},{{ end }}{{ end }})>
121
+ public static global::System.Collections.Generic.IAsyncEnumerable<({{~ for $j in 1..$i ~}}T{{ $cardinals[$j] }}{{ if !for.last }},{{ end }}{{ end }})>
120
122
EquiZip<{{~ for $j in 1..$i ~}}T{{ $cardinals[$j] }}{{ if !for.last }},{{ end }}{{ end }}>(this
121
123
{{~ for $j in 1..$i ~}}
122
124
global::System.Collections.Generic.IAsyncEnumerable<T{{ $cardinals[$j] }}> {{ $ordinals[$j] }}{{ if !for.last }},{{ end }}
123
- {{~ end ~}}) =>
124
- EquiZip({{~ for $j in 1..$i ~}}{{ $ordinals[$j] }}, {{ end }}global::System.ValueTuple.Create);
125
- {{ end ~}}
125
+ {{~ end ~}}
126
+ ) => EquiZip({{~ for $j in 1..$i ~}}{{ $ordinals[$j] }}, {{ end }}global::System.ValueTuple.Create);
127
+
128
+ {{~ end ~}}
126
129
}
0 commit comments