<#@ 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" #> // 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. using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace System.Linq { public static partial class AsyncEnumerable { <# foreach (var m in new[] { "Max", "Min" }) { foreach (var t in new[] { "int", "int?", "long", "long?", "float", "float?", "double", "double?", "decimal", "decimal?" }) { #> public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable<<#=t#>> source) { if (source == null) throw new ArgumentNullException(nameof(source)); return <#=m#>Core(source, CancellationToken.None); } public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable<<#=t#>> source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException(nameof(source)); return <#=m#>Core(source, cancellationToken); } public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable source, Func> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); return <#=m#>Core(source, selector, CancellationToken.None); } public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable source, Func> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); return <#=m#>Core(source, selector, cancellationToken); } public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable source, Func>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); return <#=m#>Core(source, selector, CancellationToken.None); } public static Task<<#=t#>> <#=m#>(this IAsyncEnumerable source, Func>> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); return <#=m#>Core(source, selector, cancellationToken); } <# } } #> } }