Skip to content

Commit 721fcb2

Browse files
committed
Refactor the source generator to be public
1 parent efaaa5d commit 721fcb2

File tree

524 files changed

+4457
-8208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

524 files changed

+4457
-8208
lines changed

Diff for: .editorconfig

+12-9
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ csharp_style_var_for_built_in_types = true:error
6868
csharp_style_var_when_type_is_apparent = true:error
6969

7070
# Expression-bodied members
71-
csharp_style_expression_bodied_accessors = true:error
72-
csharp_style_expression_bodied_constructors = true:error
73-
csharp_style_expression_bodied_indexers = true:error
74-
csharp_style_expression_bodied_lambdas = true:error
75-
csharp_style_expression_bodied_local_functions = true:error
76-
csharp_style_expression_bodied_methods = true:error
77-
csharp_style_expression_bodied_operators = true:error
78-
csharp_style_expression_bodied_properties = true:error
71+
csharp_style_expression_bodied_accessors =true:warning
72+
csharp_style_expression_bodied_constructors =true:warning
73+
csharp_style_expression_bodied_indexers =true:warning
74+
csharp_style_expression_bodied_lambdas =true:warning
75+
csharp_style_expression_bodied_local_functions =true:warning
76+
csharp_style_expression_bodied_methods =true:warning
77+
csharp_style_expression_bodied_operators =true:warning
78+
csharp_style_expression_bodied_properties =true:warning
7979

8080
# Pattern matching preferences
8181
csharp_style_pattern_matching_over_as_with_null_check = true:error
@@ -101,7 +101,7 @@ csharp_style_pattern_local_over_anonymous_function = true:error
101101
csharp_style_prefer_index_operator = true:warning
102102
csharp_style_prefer_range_operator = true:warning
103103
csharp_style_throw_expression = true:error
104-
csharp_style_unused_value_assignment_preference = discard_variable:error
104+
csharp_style_unused_value_assignment_preference =discard_variable:warning
105105
csharp_style_unused_value_expression_statement_preference = discard_variable:error
106106

107107
# 'using' directive preferences
@@ -216,3 +216,6 @@ dotnet_naming_style.camel_case.required_prefix =
216216
dotnet_naming_style.camel_case.required_suffix =
217217
dotnet_naming_style.camel_case.word_separator =
218218
dotnet_naming_style.camel_case.capitalization = camel_case
219+
220+
[*.{cs,vb}]
221+
dotnet_code_quality_unused_parameters=all:warning

Diff for: .github/workflows/dotnetcore.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ jobs:
1010
- name: Check out repository
1111
uses: actions/checkout@v2
1212
- name: Setup .NET Core
13-
uses: actions/setup-dotnet@v1.7.2
13+
uses: actions/setup-dotnet@v1
1414
with:
15-
dotnet-version: '6.0.100-preview.2.21155.3'
15+
dotnet-version: '6.0.x'
16+
include-prerelease: true
1617
- name: Test source generator
1718
run: dotnet test ./NetFabric.Hyperlinq.SourceGenerator.UnitTests/NetFabric.Hyperlinq.SourceGenerator.UnitTests.csproj
1819
- name: Build solution

Diff for: NetFabric.Hyperlinq.Benchmarks/NetFabric.Hyperlinq.Benchmarks.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
7+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
78
</PropertyGroup>
89

910
<PropertyGroup>
@@ -14,7 +15,7 @@
1415

1516
<ItemGroup>
1617
<ProjectReference Include="..\NetFabric.Hyperlinq\NetFabric.Hyperlinq.csproj" />
17-
<ProjectReference Include="..\NetFabric.Hyperlinq.UnitTests\NetFabric.Hyperlinq.UnitTests.csproj" />
18+
<ProjectReference Include="..\NetFabric.Hyperlinq.Core.UnitTests\NetFabric.Hyperlinq.Core.UnitTests.csproj" />
1819
</ItemGroup>
1920

2021
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
5-
4+
<TargetFrameworks>net48;netcoreapp2.1;netcoreapp3.1;net6.0</TargetFrameworks>
65
<IsPackable>false</IsPackable>
76
</PropertyGroup>
8-
7+
98
<ItemGroup>
10-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0" />
9+
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
10+
<PrivateAssets>all</PrivateAssets>
11+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
12+
</PackageReference>
1113
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1214
<PackageReference Include="NetFabric.Assertive" Version="3.0.1" />
13-
<PackageReference Include="xunit" Version="2.4.1" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
<PackageReference Include="NetFabric.Hyperlinq.Analyzer" Version="2.0.3">
1616
<PrivateAssets>all</PrivateAssets>
17-
</PackageReference>
18-
<PackageReference Include="coverlet.collector" Version="3.0.3">
1917
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
20+
<PackageReference Include="System.Interactive" Version="5.0.0" />
21+
<PackageReference Include="xunit" Version="2.4.1" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
2023
<PrivateAssets>all</PrivateAssets>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2125
</PackageReference>
2226
</ItemGroup>
2327

2428
<ItemGroup>
25-
<ProjectReference Include="..\NetFabric.Hyperlinq.SourceGenerator\NetFabric.Hyperlinq.SourceGenerator.csproj" />
29+
<ProjectReference Include="..\NetFabric.Hyperlinq.Core\NetFabric.Hyperlinq.Core.csproj" />
2630
</ItemGroup>
2731

2832
<ItemGroup>
29-
<Compile Update="TestData\**">
30-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
31-
</Compile>
33+
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.3.8" />
3234
</ItemGroup>
3335

3436
</Project>

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsAsyncEnumerable.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsAsyncEnumerable.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ public AsyncEnumerator<T> GetAsyncEnumerator()
2828
IAsyncEnumerator<T> IAsyncEnumerable<T>.GetAsyncEnumerator(CancellationToken _)
2929
// ReSharper disable once HeapView.BoxingAllocation
3030
=> new AsyncEnumerator<T>(source);
31-
32-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
33-
public AsyncEnumerableExtensions.AsyncValueEnumerable<AsyncEnumerableWrapper<T>, AsyncEnumerator<T>, AsyncEnumerator<T>, T, GetAsyncEnumeratorFunction, GetAsyncEnumeratorFunction> AsAsyncValueEnumerable()
34-
=> this.AsAsyncValueEnumerable<AsyncEnumerableWrapper<T>, AsyncEnumerator<T>, T, GetAsyncEnumeratorFunction>();
35-
31+
3632
public readonly struct GetAsyncEnumeratorFunction
3733
: IFunction<AsyncEnumerableWrapper<T>, CancellationToken, AsyncEnumerator<T>>
3834
{

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsAsyncValueEnumerable.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsAsyncValueEnumerable.cs

-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ AsyncEnumerator<T> IAsyncValueEnumerable<T, AsyncEnumerator<T>>.GetAsyncEnumerat
3131
IAsyncEnumerator<T> IAsyncEnumerable<T>.GetAsyncEnumerator(CancellationToken _)
3232
// ReSharper disable once HeapView.BoxingAllocation
3333
=> new AsyncEnumerator<T>(source);
34-
35-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
36-
public AsyncValueEnumerableExtensions.AsyncValueEnumerable<AsyncValueEnumerableWrapper<T>, AsyncEnumerator<T>, AsyncEnumerator<T>, T, GetAsyncEnumeratorFunction, GetAsyncEnumeratorFunction> AsAsyncValueEnumerable()
37-
=> AsyncValueEnumerableExtensions.AsAsyncValueEnumerable<AsyncValueEnumerableWrapper<T>, AsyncEnumerator<T>, T, GetAsyncEnumeratorFunction>(this);
3834

3935
public readonly struct GetAsyncEnumeratorFunction
4036
: IFunction<AsyncValueEnumerableWrapper<T>, CancellationToken, AsyncEnumerator<T>>

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsEnumerable.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsEnumerable.cs

-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
3131
IEnumerator IEnumerable.GetEnumerator()
3232
// ReSharper disable once HeapView.BoxingAllocation
3333
=> GetEnumerator();
34-
35-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
36-
public EnumerableExtensions.ValueEnumerable<EnumerableWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
37-
=> this.AsValueEnumerable<EnumerableWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>();
3834

3935
public readonly struct GetEnumeratorFunction
4036
: IFunction<EnumerableWrapper<T>, Enumerator<T>>

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsReadOnlyCollection.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsReadOnlyCollection.cs

-10
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ public ReadOnlyCollectionWrapper(T[] source)
2424

2525
public int Count
2626
=> source.Length;
27-
28-
public new ReadOnlyCollectionExtensions.ValueEnumerable<ReadOnlyCollectionWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
29-
=> ReadOnlyCollectionExtensions.AsValueEnumerable<ReadOnlyCollectionWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
30-
31-
public new readonly struct GetEnumeratorFunction
32-
: IFunction<ReadOnlyCollectionWrapper<T>, Enumerator<T>>
33-
{
34-
public Enumerator<T> Invoke(ReadOnlyCollectionWrapper<T> enumerable)
35-
=> enumerable.GetEnumerator();
36-
}
3727
}
3828
}
3929
}

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsReadOnlyList.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsReadOnlyList.cs

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ internal ReadOnlyListWrapper(T[] source)
2424

2525
public T this[int index]
2626
=> source[index];
27-
28-
public new ReadOnlyListExtensions.ValueEnumerable<ReadOnlyListWrapper<T>, T> AsValueEnumerable()
29-
=> this.AsValueEnumerable<ReadOnlyListWrapper<T>, T>();
3027
}
3128
}
3229
}

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsValueCollection.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsValueCollection.cs

-12
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ bool ICollection<T>.Remove(T item)
5151
=> throw new NotSupportedException();
5252
void ICollection<T>.Clear()
5353
=> throw new NotSupportedException();
54-
55-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
56-
public ValueReadOnlyCollectionExtensions.ValueEnumerable<ValueCollectionWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
57-
=> ValueReadOnlyCollectionExtensions.AsValueEnumerable<ValueCollectionWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
58-
59-
public readonly struct GetEnumeratorFunction
60-
: IFunction<ValueCollectionWrapper<T>, Enumerator<T>>
61-
{
62-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
63-
public Enumerator<T> Invoke(ValueCollectionWrapper<T> enumerable)
64-
=> enumerable.GetEnumerator();
65-
}
6654
}
6755
}
6856
}

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsValueEnumerable.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsValueEnumerable.cs

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
3232
IEnumerator IEnumerable.GetEnumerator()
3333
// ReSharper disable once HeapView.BoxingAllocation
3434
=> GetEnumerator();
35-
36-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
37-
public ValueEnumerableExtensions.ValueEnumerable<ValueEnumerableWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
38-
=> ValueEnumerableExtensions.AsValueEnumerable<ValueEnumerableWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
3935

4036
public readonly struct GetEnumeratorFunction
4137
: IFunction<ValueEnumerableWrapper<T>, Enumerator<T>>

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsValueList.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsValueList.cs

-12
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,6 @@ void IList<T>.Insert(int index, T item)
6868
=> throw new NotSupportedException();
6969
void IList<T>.RemoveAt(int index)
7070
=> throw new NotSupportedException();
71-
72-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
73-
public ValueReadOnlyListExtensions.ValueEnumerable<ValueListWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
74-
=> ValueReadOnlyListExtensions.AsValueEnumerable<ValueListWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
75-
76-
public readonly struct GetEnumeratorFunction
77-
: IFunction<ValueListWrapper<T>, Enumerator<T>>
78-
{
79-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
80-
public Enumerator<T> Invoke(ValueListWrapper<T> enumerable)
81-
=> enumerable.GetEnumerator();
82-
}
8371
}
8472
}
8573
}

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsValueReadOnlyCollection.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsValueReadOnlyCollection.cs

-12
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
3535
IEnumerator IEnumerable.GetEnumerator()
3636
// ReSharper disable once HeapView.BoxingAllocation
3737
=> GetEnumerator();
38-
39-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
40-
public ReadOnlyCollectionExtensions.ValueEnumerable<ValueReadOnlyCollectionWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
41-
=> ReadOnlyCollectionExtensions.AsValueEnumerable<ValueReadOnlyCollectionWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
42-
43-
public readonly struct GetEnumeratorFunction
44-
: IFunction<ValueReadOnlyCollectionWrapper<T>, Enumerator<T>>
45-
{
46-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
47-
public Enumerator<T> Invoke(ValueReadOnlyCollectionWrapper<T> enumerable)
48-
=> enumerable.GetEnumerator();
49-
}
5038
}
5139
}
5240
}

Diff for: NetFabric.Hyperlinq.UnitTests/Utils/Wrappers/Wrap.AsValueReadOnlyList.cs renamed to NetFabric.Hyperlinq.Core.UnitTests/Utils/Wrappers/Wrap.AsValueReadOnlyList.cs

-12
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,6 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
3838
IEnumerator IEnumerable.GetEnumerator()
3939
// ReSharper disable once HeapView.BoxingAllocation
4040
=> GetEnumerator();
41-
42-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
43-
public ValueReadOnlyListExtensions.ValueEnumerable<ValueReadOnlyListWrapper<T>, Enumerator<T>, Enumerator<T>, T, GetEnumeratorFunction, GetEnumeratorFunction> AsValueEnumerable()
44-
=> ValueReadOnlyListExtensions.AsValueEnumerable<ValueReadOnlyListWrapper<T>, Enumerator<T>, T, GetEnumeratorFunction>(this);
45-
46-
public readonly struct GetEnumeratorFunction
47-
: IFunction<ValueReadOnlyListWrapper<T>, Enumerator<T>>
48-
{
49-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
50-
public Enumerator<T> Invoke(ValueReadOnlyListWrapper<T> enumerable)
51-
=> enumerable.GetEnumerator();
52-
}
5341
}
5442
}
5543
}

Diff for: NetFabric.Hyperlinq/Aggregation/Count/Count.ReadOnlySpan.cs renamed to NetFabric.Hyperlinq.Core/Aggregation/Count/Count.ReadOnlySpan.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ namespace NetFabric.Hyperlinq
66
public static partial class ArrayExtensions
77
{
88
[MethodImpl(MethodImplOptions.AggressiveInlining)]
9-
static int Count<TSource>(this ReadOnlySpan<TSource> source)
9+
public static int Count<TSource>(ReadOnlySpan<TSource> source)
1010
=> source.Length;
1111

1212
[MethodImpl(MethodImplOptions.AggressiveInlining)]
13-
static int Count<TSource>(this ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
13+
public static int Count<TSource>(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
1414
=> source.Count(new FunctionWrapper<TSource, bool>(predicate));
1515

16-
static int Count<TSource, TPredicate>(this ReadOnlySpan<TSource> source, TPredicate predicate = default)
16+
public static int Count<TSource, TPredicate>(this ReadOnlySpan<TSource> source, TPredicate predicate = default)
1717
where TPredicate: struct, IFunction<TSource, bool>
1818
{
1919
var counter = 0;
@@ -25,10 +25,10 @@ static int Count<TSource, TPredicate>(this ReadOnlySpan<TSource> source, TPredic
2525
}
2626

2727
[MethodImpl(MethodImplOptions.AggressiveInlining)]
28-
static int Count<TSource>(this ReadOnlySpan<TSource> source, Func<TSource, int, bool> predicate)
28+
public static int Count<TSource>(this ReadOnlySpan<TSource> source, Func<TSource, int, bool> predicate)
2929
=> source.CountAt(new FunctionWrapper<TSource, int, bool>(predicate));
3030

31-
static int CountAt<TSource, TPredicate>(this ReadOnlySpan<TSource> source, TPredicate predicate = default)
31+
public static int CountAt<TSource, TPredicate>(this ReadOnlySpan<TSource> source, TPredicate predicate = default)
3232
where TPredicate: struct, IFunction<TSource, int, bool>
3333
{
3434
var counter = 0;

Diff for: NetFabric.Hyperlinq/Aggregation/Count/Count.ValueEnumerable.cs renamed to NetFabric.Hyperlinq.Core/Aggregation/Count/Count.ValueEnumerable.cs

-12
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable sour
2020
return counter;
2121
}
2222

23-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
24-
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source, Func<TSource, bool> predicate)
25-
where TEnumerable : IValueEnumerable<TSource, TEnumerator>
26-
where TEnumerator : struct, IEnumerator<TSource>
27-
=> source.Count<TEnumerable, TEnumerator, TSource, FunctionWrapper<TSource, bool>>(new FunctionWrapper<TSource, bool>(predicate));
28-
2923
public static int Count<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnumerable source, TPredicate predicate = default)
3024
where TEnumerable : IValueEnumerable<TSource, TEnumerator>
3125
where TEnumerator : struct, IEnumerator<TSource>
@@ -40,12 +34,6 @@ public static int Count<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnu
4034
}
4135
return counter;
4236
}
43-
44-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
45-
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source, Func<TSource, int, bool> predicate)
46-
where TEnumerable : IValueEnumerable<TSource, TEnumerator>
47-
where TEnumerator : struct, IEnumerator<TSource>
48-
=> source.CountAt<TEnumerable, TEnumerator, TSource, FunctionWrapper<TSource, int, bool>>(new FunctionWrapper<TSource, int, bool>(predicate));
4937

5038
public static int CountAt<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnumerable source, TPredicate predicate = default)
5139
where TEnumerable : IValueEnumerable<TSource, TEnumerator>

Diff for: NetFabric.Hyperlinq/Aggregation/Count/Count.ValueReadOnlyCollection.cs renamed to NetFabric.Hyperlinq.Core/Aggregation/Count/Count.ValueReadOnlyCollection.cs

+1-12
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ namespace NetFabric.Hyperlinq
66
{
77
public static partial class ValueReadOnlyCollectionExtensions
88
{
9+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
910
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source)
1011
where TEnumerable : IValueReadOnlyCollection<TSource, TEnumerator>
1112
where TEnumerator : struct, IEnumerator<TSource>
1213
=> source.Count;
1314

14-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
15-
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source, Func<TSource, bool> predicate)
16-
where TEnumerable : IValueReadOnlyCollection<TSource, TEnumerator>
17-
where TEnumerator : struct, IEnumerator<TSource>
18-
=> Count<TEnumerable, TEnumerator, TSource, FunctionWrapper<TSource, bool>>(source, new FunctionWrapper<TSource, bool>(predicate));
19-
2015
public static int Count<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnumerable source, TPredicate predicate = default)
2116
where TEnumerable : IValueReadOnlyCollection<TSource, TEnumerator>
2217
where TEnumerator : struct, IEnumerator<TSource>
@@ -26,12 +21,6 @@ public static int Count<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnu
2621
{Count: 0} => 0,
2722
_ => ValueEnumerableExtensions.Count<TEnumerable, TEnumerator, TSource, TPredicate>(source, predicate)
2823
};
29-
30-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
31-
public static int Count<TEnumerable, TEnumerator, TSource>(this TEnumerable source, Func<TSource, int, bool> predicate)
32-
where TEnumerable : IValueReadOnlyCollection<TSource, TEnumerator>
33-
where TEnumerator : struct, IEnumerator<TSource>
34-
=> CountAt<TEnumerable, TEnumerator, TSource, FunctionWrapper<TSource, int, bool>>(source, new FunctionWrapper<TSource, int, bool>(predicate));
3524

3625
public static int CountAt<TEnumerable, TEnumerator, TSource, TPredicate>(this TEnumerable source, TPredicate predicate = default)
3726
where TEnumerable : IValueReadOnlyCollection<TSource, TEnumerator>

0 commit comments

Comments
 (0)