Class RangeValidator<T>
- Namespace
- SteamNetworkLib.Sync
- Assembly
- SteamNetworkLib.dll
Validator for numeric ranges.
public class RangeValidator<T> : ISyncValidator<T> where T : IComparable<T>
Type Parameters
T
- Inheritance
-
RangeValidator<T>
- Implements
- Inherited Members
Constructors
RangeValidator(T, T, bool)
Creates a new range validator.
public RangeValidator(T min, T max, bool inclusive = true)
Parameters
minTMinimum value (inclusive).
maxTMaximum value (inclusive).
inclusiveboolIf true, min and max are included in the valid range.
Methods
GetErrorMessage(T)
Gets a human-readable error message describing why validation failed.
public string? GetErrorMessage(T value)
Parameters
valueTThe invalid value.
Returns
- string
An error message, or null if no specific message is available.
IsValid(T)
Validates a value before it is synchronized.
public bool IsValid(T value)
Parameters
valueTThe value to validate.
Returns
- bool
True if the value is valid, false otherwise.