diff --git a/api_list.include.md b/api_list.include.md index 2551ce55..0d79f8c3 100644 --- a/api_list.include.md +++ b/api_list.include.md @@ -11,7 +11,9 @@ ### IEnumerable * `IEnumerable Except(TSource)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) + * `IEnumerable Except(TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) * `IEnumerable Except(TSource, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) + * `IEnumerable Except(IEqualityComparer, TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) * `TSource MaxBy(Func)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) * `TSource MaxBy(Func, IComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby?view=net-8.0#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1))-system-collections-generic-icomparer((-1)))) * `TSource MinBy(Func)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.minby#system-linq-enumerable-minby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8ed6ef5c..ee2cc11e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@ - 1.25.0 + 1.26.0 1.0.0 Polyfill true diff --git a/src/Polyfill/PolyfillExtensions_IEnumerable.cs b/src/Polyfill/PolyfillExtensions_IEnumerable.cs index 43a78da7..a6e8ad1e 100644 --- a/src/Polyfill/PolyfillExtensions_IEnumerable.cs +++ b/src/Polyfill/PolyfillExtensions_IEnumerable.cs @@ -10,14 +10,16 @@ static partial class PolyfillExtensions { /// - /// Produces the set difference of two sequences by using the default equality comparer to compare values. + /// Produces a set items excluding by using the default equality comparer to compare values. /// /// An whose elements that are not equal to will be returned. /// An that is elements equal it will cause those elements to be removed from the returned sequence. /// The type of the elements of . /// A sequence that contains the items of but excluding . [Link("https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))")] - public static IEnumerable Except(this IEnumerable target, TSource item) + public static IEnumerable Except( + this IEnumerable target, + TSource item) { return Except(target, item, null); } @@ -27,11 +29,29 @@ public static IEnumerable Except(this IEnumerable tar /// /// An whose elements that are not equal to will be returned. /// An that is elements equal it will cause those elements to be removed from the returned sequence. + /// The type of the elements of . + /// A sequence that contains the items of but excluding . + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))")] + public static IEnumerable Except( + this IEnumerable target, + params TSource[] items) + { + return target.Except((IEnumerable)items); + } + + /// + /// Produces a set items excluding by using to compare values. + /// + /// An whose elements that are not equal to will be returned. + /// An that is elements equal it will cause those elements to be removed from the returned sequence. /// An to compare values. /// The type of the elements of . /// A sequence that contains the items of but excluding . [Link("https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))")] - public static IEnumerable Except(this IEnumerable target, TSource item, IEqualityComparer? comparer) + public static IEnumerable Except( + this IEnumerable target, + TSource item, + IEqualityComparer? comparer) { var set = new HashSet(comparer); set.Add(item); @@ -44,6 +64,23 @@ public static IEnumerable Except(this IEnumerable tar } } + /// + /// Produces the set difference of two sequences by to compare values. + /// + /// An whose elements that are not equal to will be returned. + /// An that is elements equal it will cause those elements to be removed from the returned sequence. + /// The type of the elements of . + /// A sequence that contains the items of but excluding . + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.maxby#system-linq-enumerable-maxby-2(system-collections-generic-ienumerable((-0))-system-func((-0-1)))")] + public static IEnumerable Except( + this IEnumerable target, + IEqualityComparer comparer, + params TSource[] items) + { + return target.Except((IEnumerable)items, comparer); + } + + #if NETSTANDARD || NETCOREAPP || NETFRAMEWORK || NET5_0 ///