Table of Contents

Class PredicateValidator<T>

Namespace
SteamNetworkLib.Sync
Assembly
SteamNetworkLib.dll

Base class for simple validators using a predicate function.

public class PredicateValidator<T> : ISyncValidator<T>

Type Parameters

T

The type of value to validate.

Inheritance
PredicateValidator<T>
Implements
Inherited Members

Constructors

PredicateValidator(Func<T, bool>, string)

Creates a new predicate-based validator.

public PredicateValidator(Func<T, bool> predicate, string errorMessage)

Parameters

predicate Func<T, bool>

Function that returns true if the value is valid.

errorMessage string

Error message to return when validation fails.

Methods

GetErrorMessage(T)

Gets a human-readable error message describing why validation failed.

public string? GetErrorMessage(T value)

Parameters

value T

The 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

value T

The value to validate.

Returns

bool

True if the value is valid, false otherwise.