Skip to content

Commit 117207c

Browse files
author
Gabriel Erzse
committed
Remove primary constructor syntax
The primary constructor syntax seems to be not supported by older dotnet versions, so don't use it. Also switch from `class` to `struct`, to better reflect the fact that RedisValueWithScore is just a data storage item.
1 parent bbe2c4a commit 117207c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/NRedisStack/CoreCommands/DataTypes/RedisValueWithScore.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,29 @@
33
namespace NRedisStack.Core.DataTypes;
44

55
/// <summary>
6-
/// Holds a value with an associated score.
6+
/// Holds a <see cref="RedisValue"/> with an associated score.
77
/// Used when working with sorted sets.
88
/// </summary>
9-
public class RedisValueWithScore(RedisValue value, double score)
9+
public struct RedisValueWithScore
1010
{
11+
/// <summary>
12+
/// Pair a <see cref="RedisValue"/> with a numeric score.
13+
/// </summary>
14+
public RedisValueWithScore(RedisValue value, double score)
15+
{
16+
Value = value;
17+
Score = score;
18+
}
19+
1120
/// <summary>
1221
/// The value of an item stored in a sorted set. For example, in the Redis command
1322
/// <c>ZADD my-set 5.1 my-value</c>, the value is <c>my-value</c>.
1423
/// </summary>
15-
public RedisValue Value { get; } = value;
24+
public RedisValue Value { get; }
1625

1726
/// <summary>
1827
/// The score of an item stored in a sorted set. For example, in the Redis command
1928
/// <c>ZADD my-set 5.1 my-value</c>, the score is <c>5.1</c>.
2029
/// </summary>
21-
public double Score { get; } = score;
30+
public double Score { get; }
2231
}

0 commit comments

Comments
 (0)