Skip to content

Commit 1a7cee9

Browse files
Use primary constructor
Use primary constructor in `GeneratorHelper`.
1 parent 3d7810e commit 1a7cee9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Polly.Core/Simmy/Utils/GeneratorHelper.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
namespace Polly.Simmy.Utils;
22

3-
internal sealed class GeneratorHelper<TResult>
3+
internal sealed class GeneratorHelper<TResult>(Func<int, int> weightGenerator)
44
{
5-
private readonly Func<int, int> _weightGenerator;
5+
private readonly Func<int, int> _weightGenerator = weightGenerator;
66

77
private readonly List<int> _weights = [];
88
private readonly List<Func<ResilienceContext, Outcome<TResult>>> _factories = [];
99
private int _totalWeight;
1010

11-
public GeneratorHelper(Func<int, int> weightGenerator) => _weightGenerator = weightGenerator;
12-
1311
public void AddOutcome(Func<ResilienceContext, Outcome<TResult>> generator, int weight)
1412
{
1513
Guard.NotNull(generator);

0 commit comments

Comments
 (0)