12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // Licensed to the .NET Foundation under one or more agreements.
- // The .NET Foundation licenses this file to you under the MIT License.
- // See the LICENSE file in the project root for more information.
- <#@ template debug="false" hostspecific="false" language="C#" #>
- <#@ assembly name="System.Core" #>
- <#@ import namespace="System.Linq" #>
- <#@ import namespace="System.Text" #>
- <#@ import namespace="System.Collections.Generic" #>
- <#@ output extension=".cs" #>
- using System.Threading.Tasks;
- namespace System.Reactive.Joins
- {
- <#
- for (var i = 1; i <= 16; i++)
- {
- var genArgs = string.Join(", ", Enumerable.Range(1, i).Select(j => "TSource" + j));
- var args = string.Join(", ", Enumerable.Range(1, i).Select(j => "IAsyncObservable<TSource" + j + "> source" + j));
- #>
- public class AsyncPattern<<#=genArgs#>> : AsyncPattern
- {
- <#
- for (var j = 1; j <= i; j++)
- {
- #>
- internal IAsyncObservable<TSource<#=j#>> Source<#=j#> { get; }
- <#
- }
- #>
- internal AsyncPattern(<#=args#>)
- {
- <#
- for (var j = 1; j <= i; j++)
- {
- #>
- Source<#=j#> = source<#=j#>;
- <#
- }
- #>
- }
- public AsyncPlan<TResult> Then<TResult>(Func<<#=genArgs#>, TResult> selector)
- {
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return new AsyncPlan<<#=genArgs#>, TResult>(this, selector);
- }
- public AsyncPlan<TResult> Then<TResult>(Func<<#=genArgs#>, ValueTask<TResult>> selector)
- {
- if (selector == null)
- throw new ArgumentNullException(nameof(selector));
- return new AsyncPlanWithTask<<#=genArgs#>, TResult>(this, selector);
- }
- }
- <#
- }
- #>
- }
|