We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d7810e commit 1a7cee9Copy full SHA for 1a7cee9
src/Polly.Core/Simmy/Utils/GeneratorHelper.cs
@@ -1,15 +1,13 @@
1
namespace Polly.Simmy.Utils;
2
3
-internal sealed class GeneratorHelper<TResult>
+internal sealed class GeneratorHelper<TResult>(Func<int, int> weightGenerator)
4
{
5
- private readonly Func<int, int> _weightGenerator;
+ private readonly Func<int, int> _weightGenerator = weightGenerator;
6
7
private readonly List<int> _weights = [];
8
private readonly List<Func<ResilienceContext, Outcome<TResult>>> _factories = [];
9
private int _totalWeight;
10
11
- public GeneratorHelper(Func<int, int> weightGenerator) => _weightGenerator = weightGenerator;
12
-
13
public void AddOutcome(Func<ResilienceContext, Outcome<TResult>> generator, int weight)
14
15
Guard.NotNull(generator);
0 commit comments