diff --git a/MoreLinq/AssertCount.cs b/MoreLinq/AssertCount.cs index debe5f3ae..14a55c1a4 100644 --- a/MoreLinq/AssertCount.cs +++ b/MoreLinq/AssertCount.cs @@ -22,8 +22,6 @@ namespace MoreLinq static partial class MoreEnumerable { - static readonly Func DefaultErrorSelector = OnAssertCountFailure; - /// /// Asserts that a source sequence contains a given count of elements. /// @@ -40,7 +38,7 @@ static partial class MoreEnumerable /// public static IEnumerable AssertCount(this IEnumerable source, int count) => - AssertCount(source, count, DefaultErrorSelector); + AssertCount(source, count, static (cmp, count) => new SequenceException(FormatSequenceLengthErrorMessage(cmp, count))); /// /// Asserts that a source sequence contains a given count of elements. @@ -93,9 +91,6 @@ public static IEnumerable AssertCount(this IEnumerable - new SequenceException(FormatSequenceLengthErrorMessage(cmp, count)); - internal static string FormatSequenceLengthErrorMessage(int cmp, int count) => $"Sequence contains too {(cmp < 0 ? "few" : "many")} elements when exactly {count:N0} {(count == 1 ? "was" : "were")} expected."; } diff --git a/MoreLinq/Extensions.g.cs b/MoreLinq/Extensions.g.cs index a19f82c10..e543cbe72 100644 --- a/MoreLinq/Extensions.g.cs +++ b/MoreLinq/Extensions.g.cs @@ -498,7 +498,6 @@ public static IEnumerable Assert(this IEnumerable sou [GeneratedCode("MoreLinq.ExtensionsGenerator", "1.0.0.0")] public static partial class AssertCountExtension { - /// /// Asserts that a source sequence contains a given count of elements. ///