AsyncEnumerable.MinAsync<TSource> Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Retourneert de minimumwaarde in een algemene reeks.
public static System.Threading.Tasks.ValueTask<TSource?> MinAsync<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Collections.Generic.IComparer<TSource>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member MinAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Collections.Generic.IComparer<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Source>
<Extension()>
Public Function MinAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), Optional comparer As IComparer(Of TSource) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TSource)
Type parameters
- TSource
Het type van de elementen van source.
Parameters
- source
- IAsyncEnumerable<TSource>
Een reeks waarden om de minimumwaarde van te bepalen.
- comparer
- IComparer<TSource>
De IComparer<T> waarden die moeten worden vergeleken.
- cancellationToken
- CancellationToken
De CancellationToken te controleren op annuleringsaanvragen. De standaardwaarde is None.
Retouren
De minimumwaarde in de reeks.
Uitzonderingen
source is null.
Er is geen object in source de IComparable implementatie of IComparable<T> interface.
Opmerkingen
Als het type TSource wordt geïmplementeerd IComparable<T>, gebruikt de MinAsync<TSource>(IAsyncEnumerable<TSource>, IComparer<TSource>, CancellationToken) methode die implementatie om waarden te vergelijken. Als het type TSource wordt geïmplementeerd IComparable, wordt die implementatie gebruikt om waarden te vergelijken.
Als TSource dit een verwijzingstype is en de bronreeks leeg is of alleen waarden bevat, nullretourneert nulldeze methode .