@@ -1678,7 +1678,7 @@ public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnume
16781678
16791679 /// <summary>
16801680 /// Checks if the source items have been seen before by checking
1681- /// a key extracted from such items agains a set of keys and
1681+ /// a key extracted from such items against a set of keys and
16821682 /// drops such items, ensuring that only distinct source items pass
16831683 /// through.
16841684 /// </summary>
@@ -1696,5 +1696,66 @@ public static IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this IAsyncEnume
16961696 RequireNonNull ( setSupplier , nameof ( setSupplier ) ) ;
16971697 return new Distinct < TSource , TKey > ( source , keySelector , setSupplier ) ;
16981698 }
1699+
1700+ /// <summary>
1701+ /// Checks if the current item is distinct from the previous item,
1702+ /// and if so it is no it is relayed.
1703+ /// </summary>
1704+ /// <typeparam name="TSource">The element type of the source and result sequences.</typeparam>
1705+ /// <param name="source">The source sequence to filter for distinct subsequent items.</param>
1706+ /// <returns>The new IAsyncEnumerable sequence.</returns>
1707+ public static IAsyncEnumerable < TSource > DistinctUntilChanged < TSource > ( this IAsyncEnumerable < TSource > source )
1708+ {
1709+ return DistinctUntilChanged ( source , v => v , EqualityComparer < TSource > . Default ) ;
1710+ }
1711+
1712+ /// <summary>
1713+ /// Checks if the current item is distinct from the previous item,
1714+ /// and if so it is no it is relayed,
1715+ /// based on comparing the items via a custom equality comparer.
1716+ /// </summary>
1717+ /// <typeparam name="TSource">The element type of the source and result sequences.</typeparam>
1718+ /// <param name="source">The source sequence to filter for distinct subsequent items.</param>
1719+ /// <param name="comparer">The comparer for comparing the source items.</param>
1720+ /// <returns>The new IAsyncEnumerable sequence.</returns>
1721+ public static IAsyncEnumerable < TSource > DistinctUntilChanged < TSource > ( this IAsyncEnumerable < TSource > source , IEqualityComparer < TSource > comparer )
1722+ {
1723+ return DistinctUntilChanged ( source , v => v , comparer ) ;
1724+ }
1725+
1726+ /// <summary>
1727+ /// Checks if the current item is distinct from the previous item,
1728+ /// and if so it is no it is relayed,
1729+ /// based on comparing keys extracted via a function.
1730+ /// </summary>
1731+ /// <typeparam name="TSource">The element type of the source and result sequences.</typeparam>
1732+ /// <typeparam name="TKey">The type of the keys extracted for comparison</typeparam>
1733+ /// <param name="source">The source sequence to filter for distinct subsequent items.</param>
1734+ /// <param name="keySelector">The function receiving the current source item and should return a key value for comparison.</param>
1735+ /// <returns>The new IAsyncEnumerable sequence.</returns>
1736+ public static IAsyncEnumerable < TSource > DistinctUntilChanged < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector )
1737+ {
1738+ return DistinctUntilChanged ( source , keySelector , EqualityComparer < TKey > . Default ) ;
1739+ }
1740+
1741+ /// <summary>
1742+ /// Checks if the current item is distinct from the previous item,
1743+ /// and if so it is no it is relayed,
1744+ /// based on comparing keys extracted via a function and using
1745+ /// a custom equality comparer.
1746+ /// </summary>
1747+ /// <typeparam name="TSource">The element type of the source and result sequences.</typeparam>
1748+ /// <typeparam name="TKey">The type of the keys extracted for comparison</typeparam>
1749+ /// <param name="source">The source sequence to filter for distinct subsequent items.</param>
1750+ /// <param name="keySelector">The function receiving the current source item and should return a key value for comparison.</param>
1751+ /// <param name="keyComparer">The comparer for comparing the key values extracted via <paramref name="keySelector"/>.</param>
1752+ /// <returns>The new IAsyncEnumerable sequence.</returns>
1753+ public static IAsyncEnumerable < TSource > DistinctUntilChanged < TSource , TKey > ( this IAsyncEnumerable < TSource > source , Func < TSource , TKey > keySelector , IEqualityComparer < TKey > keyComparer )
1754+ {
1755+ RequireNonNull ( source , nameof ( source ) ) ;
1756+ RequireNonNull ( keySelector , nameof ( keySelector ) ) ;
1757+ RequireNonNull ( keyComparer , nameof ( keyComparer ) ) ;
1758+ return new DistinctUntilChanged < TSource , TKey > ( source , keySelector , keyComparer ) ;
1759+ }
16991760 }
17001761}
0 commit comments