Struct ScoreValue
Value container for a single score metric, combining a numeric value with its kind.
Immutable value object that supports equality comparison.
Assembly: Serenity.Score.Domain.dll
Syntax
public readonly struct ScoreValue : IEquatable<ScoreValue>
Constructors
ScoreValue(float, ScoreMetricKind)
Creates a new ScoreValue with the specified amount and kind.
Declaration
public ScoreValue(float amount, ScoreMetricKind kind)
Parameters
| Type |
Name |
Description |
| float |
amount |
The numeric value.
|
| ScoreMetricKind |
kind |
The metric interpretation kind.
|
Fields
Amount
The numeric value of this score metric.
Declaration
public readonly float Amount
Field Value
Kind
The kind that defines how this metric is interpreted.
Declaration
public readonly ScoreMetricKind Kind
Field Value
Methods
Add(float)
Returns a new ScoreValue with the amount added.
Declaration
public ScoreValue Add(float delta)
Parameters
| Type |
Name |
Description |
| float |
delta |
The amount to add.
|
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with the updated amount.
|
Divide(float)
Returns a new ScoreValue with the amount divided.
Declaration
public ScoreValue Divide(float divisor)
Parameters
| Type |
Name |
Description |
| float |
divisor |
The divisor. Must not be zero.
|
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with the updated amount.
|
Equals(ScoreValue)
Declaration
public bool Equals(ScoreValue other)
Parameters
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
Multiply(float)
Returns a new ScoreValue with the amount multiplied.
Declaration
public ScoreValue Multiply(float factor)
Parameters
| Type |
Name |
Description |
| float |
factor |
The multiplication factor.
|
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with the updated amount.
|
Reset()
Returns a zero-value ScoreValue of the same kind.
Declaration
public ScoreValue Reset()
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with amount set to zero.
|
Subtract(float)
Returns a new ScoreValue with the amount subtracted.
Declaration
public ScoreValue Subtract(float delta)
Parameters
| Type |
Name |
Description |
| float |
delta |
The amount to subtract.
|
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with the updated amount.
|
ToString()
Declaration
public override string ToString()
Returns
Overrides
WithAmount(float)
Returns a new ScoreValue with the specified amount, preserving the kind.
Declaration
public ScoreValue WithAmount(float amount)
Parameters
| Type |
Name |
Description |
| float |
amount |
The new amount.
|
Returns
| Type |
Description |
| ScoreValue |
A new ScoreValue with the updated amount.
|
Operators
operator ==(ScoreValue, ScoreValue)
Declaration
public static bool operator ==(ScoreValue left, ScoreValue right)
Parameters
Returns
operator !=(ScoreValue, ScoreValue)
Declaration
public static bool operator !=(ScoreValue left, ScoreValue right)
Parameters
Returns
Implements