Skip to content

Commit d7c23e2

Browse files
Cleanup and simplification.
1 parent a92382d commit d7c23e2

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Extensions.ActionBlock.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ namespace Open.Threading.Dataflow
77
public static class ActionBlock
88
{
99
public static ActionBlock<T> New<T>(Action<T> action)
10-
=> new ActionBlock<T>(action);
10+
=> new(action);
1111

1212
public static ActionBlock<T> New<T>(Action<T> action, ExecutionDataflowBlockOptions options)
13-
=> new ActionBlock<T>(action, options);
13+
=> new(action, options);
1414

1515
public static ActionBlock<T> New<T>(Action<T> consumer, int maxParallel)
16-
=> new ActionBlock<T>(consumer, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = maxParallel });
16+
=> new(consumer, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = maxParallel });
1717

1818
public static ActionBlock<T> NewAsync<T>(Func<T, Task> action)
19-
=> new ActionBlock<T>(action);
19+
=> new(action);
2020

2121
public static ActionBlock<T> NewAsync<T>(Func<T, Task> action, ExecutionDataflowBlockOptions options)
22-
=> new ActionBlock<T>(action, options);
22+
=> new(action, options);
2323

2424
public static ActionBlock<T> NewAsync<T>(Func<T, Task> consumer, int maxParallel)
25-
=> new ActionBlock<T>(consumer, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = maxParallel });
25+
=> new(consumer, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = maxParallel });
2626
}
2727
}

Filters/Changed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public ChangedFilter(ITargetBlock<T> target, DataflowMessageStatus defaultRespon
99
{
1010
}
1111

12-
readonly object SyncLock = new object();
12+
readonly object SyncLock = new();
1313
T _last = default!;
1414

1515
protected override bool Accept(T messageValue)

Filters/Distinct.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public DistinctFilter(ITargetBlock<T> target, DataflowMessageStatus defaultRespo
1010
{
1111
}
1212

13-
private readonly HashSet<T> _set = new HashSet<T>();
13+
private readonly HashSet<T> _set = new();
1414

1515
protected override bool Accept(T messageValue)
1616
{

Open.Threading.Dataflow.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
7+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
78
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
89
<Authors>electricessence</Authors>
910
<Description>

0 commit comments

Comments
 (0)