diff --git a/api_list.include.md b/api_list.include.md index e6b66394..296d020a 100644 --- a/api_list.include.md +++ b/api_list.include.md @@ -21,10 +21,6 @@ * `IEnumerable> AggregateBy(Func, Func, Func, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.aggregateby?view=net-9.0#system-linq-enumerable-aggregateby-3(system-collections-generic-ienumerable((-0))-system-func((-0-1))-2-system-func((-2-0-2))-system-collections-generic-iequalitycomparer((-1)))) * `IEnumerable Chunk(Int32)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.chunk) * `IEnumerable> CountBy(Func, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.countby) - * `IEnumerable Except(TSource)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))) - * `IEnumerable Except(TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))) - * `IEnumerable Except(TSource, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))) - * `IEnumerable Except(IEqualityComparer, TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))) * `IEnumerable> Index()` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.index#system-linq-enumerable-index-1(system-collections-generic-ienumerable((-0)))) * `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)))) @@ -316,9 +312,9 @@ #### StringPolyfill - * `String Join(Char, String[])` - * `String Join(Char, Object[])` - * `String Join(Char, String[], Int32, Int32)` - * `String Join(Char, IEnumerable)` + * `String Join(Char, String[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string())) + * `String Join(Char, Object[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object())) + * `String Join(Char, String[], Int32, Int32)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32)) + * `String Join(Char, IEnumerable)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0)))) diff --git a/readme.md b/readme.md index 51a560a7..29ead529 100644 --- a/readme.md +++ b/readme.md @@ -377,10 +377,6 @@ The class `Polyfill` includes the following extension methods: * `IEnumerable> AggregateBy(Func, Func, Func, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.aggregateby?view=net-9.0#system-linq-enumerable-aggregateby-3(system-collections-generic-ienumerable((-0))-system-func((-0-1))-2-system-func((-2-0-2))-system-collections-generic-iequalitycomparer((-1)))) * `IEnumerable Chunk(Int32)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.chunk) * `IEnumerable> CountBy(Func, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.countby) - * `IEnumerable Except(TSource)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))) - * `IEnumerable Except(TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))) - * `IEnumerable Except(TSource, IEqualityComparer)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))) - * `IEnumerable Except(IEqualityComparer, TSource[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))) * `IEnumerable> Index()` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.index#system-linq-enumerable-index-1(system-collections-generic-ienumerable((-0)))) * `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)))) @@ -672,10 +668,10 @@ The class `Polyfill` includes the following extension methods: #### StringPolyfill - * `String Join(Char, String[])` - * `String Join(Char, Object[])` - * `String Join(Char, String[], Int32, Int32)` - * `String Join(Char, IEnumerable)` + * `String Join(Char, String[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string())) + * `String Join(Char, Object[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object())) + * `String Join(Char, String[], Int32, Int32)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32)) + * `String Join(Char, IEnumerable)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0)))) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b3287a2c..48f9830c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@ - 2.6.5 + 3.0.0 1.0.0 Polyfill true diff --git a/src/Polyfill/Polyfill_IEnumerable.cs b/src/Polyfill/Polyfill_IEnumerable.cs index cabf81a7..059cc889 100644 --- a/src/Polyfill/Polyfill_IEnumerable.cs +++ b/src/Polyfill/Polyfill_IEnumerable.cs @@ -9,70 +9,70 @@ static partial class Polyfill { - /// - /// 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.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))")] - public static IEnumerable Except( - this IEnumerable target, - TSource item) => - Except(target, item, null); - - /// - /// Produces the set difference of two sequences 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.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))")] - public static IEnumerable Except( - this IEnumerable target, - params TSource[] items) => - 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.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))")] - public static IEnumerable Except( - this IEnumerable target, - TSource item, - IEqualityComparer? comparer) - { - var set = new HashSet(comparer); - set.Add(item); - foreach (TSource element in target) - { - if (set.Add(element)) - { - yield return element; - } - } - } - - /// - /// 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.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))")] - public static IEnumerable Except( - this IEnumerable target, - IEqualityComparer comparer, - params TSource[] items) => - target.Except((IEnumerable)items, comparer); + // /// + // /// 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.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))")] + // public static IEnumerable Except( + // this IEnumerable target, + // TSource item) => + // Except(target, item, null); + // + // /// + // /// Produces the set difference of two sequences 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.except?view=net-8.0#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0)))")] + // public static IEnumerable Except( + // this IEnumerable target, + // params TSource[] items) => + // 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.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))")] + // public static IEnumerable Except( + // this IEnumerable target, + // TSource item, + // IEqualityComparer? comparer) + // { + // var set = new HashSet(comparer); + // set.Add(item); + // foreach (TSource element in target) + // { + // if (set.Add(element)) + // { + // yield return element; + // } + // } + // } + // + // /// + // /// 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.except#system-linq-enumerable-except-1(system-collections-generic-ienumerable((-0))-system-collections-generic-ienumerable((-0))-system-collections-generic-iequalitycomparer((-0)))")] + // public static IEnumerable Except( + // this IEnumerable target, + // IEqualityComparer comparer, + // params TSource[] items) => + // target.Except((IEnumerable)items, comparer); #if !NET9_0_OR_GREATER && FeatureValueTuple diff --git a/src/Polyfill/StringPolyfill.cs b/src/Polyfill/StringPolyfill.cs index 7c5769d9..48aadf51 100644 --- a/src/Polyfill/StringPolyfill.cs +++ b/src/Polyfill/StringPolyfill.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using Link = System.ComponentModel.DescriptionAttribute; [ExcludeFromCodeCoverage] [DebuggerNonUserCode] @@ -15,6 +16,10 @@ #endif static partial class StringPolyfill { + /// + /// Concatenates an array of strings, using the specified separator between each member. + /// + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string())")] public static string Join(char separator, string[] values) { #if NETSTANDARD2_0 || NETFRAMEWORK @@ -24,6 +29,10 @@ public static string Join(char separator, string[] values) #endif } + /// + /// Concatenates the string representations of an array of objects, using the specified separator between each member. + /// + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object())")] public static string Join(char separator, object[] values) { #if NETSTANDARD2_0 || NETFRAMEWORK @@ -33,6 +42,10 @@ public static string Join(char separator, object[] values) #endif } + /// + /// Concatenates the specified elements of a string array, using the specified separator between each element. + /// + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32)")] public static string Join(char separator, string?[] value, int startIndex, int count) { #if NETSTANDARD2_0 || NETFRAMEWORK @@ -42,6 +55,10 @@ public static string Join(char separator, string?[] value, int startIndex, int c #endif } + /// + /// Concatenates the specified elements of a string array, using the specified separator between each element. + /// + [Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0)))")] public static string Join(char separator, IEnumerable values) { #if NETSTANDARD2_0 || NETFRAMEWORK diff --git a/src/Tests/PolyfillTests_IEnumerable.cs b/src/Tests/PolyfillTests_IEnumerable.cs index 1de5f931..2aff5bc2 100644 --- a/src/Tests/PolyfillTests_IEnumerable.cs +++ b/src/Tests/PolyfillTests_IEnumerable.cs @@ -8,12 +8,12 @@ public void MaxBy() Assert.AreEqual(2, enumerable.MaxBy(_ => _)); } - [Test] - public void Except() - { - var enumerable = new List {1, 2}; - Assert.AreEqual(1, enumerable.Except(2).Single()); - } + // [Test] + // public void Except() + // { + // var enumerable = new List {1, 2}; + // Assert.AreEqual(1, enumerable.Except(2).Single()); + // } [Test] public void MinBy()