OperatorRegistry

Ecng.ComponentModel

Provides a registry for operators to perform mathematical and comparison operations.

Konstruktoren

OperatorRegistry
private OperatorRegistry()
operatorRegistry = OperatorRegistry()

Initializes static members of the OperatorRegistry class. Registers the default set of operators.

Methoden

AddOperator``1
public static void AddOperator<T>(IOperator<T> operator)
OperatorRegistry.AddOperator(operator)

Adds an operator for the specified type.

operator
The operator to add.
GetOperator
public static IOperator GetOperator(Type type)
result = OperatorRegistry.GetOperator(type)

Retrieves the operator associated with the specified type.

type
The type for which to retrieve the operator.

Rückgabe: The operator associated with the given type.

GetOperator``1
public static IOperator<T> GetOperator<T>()
result = OperatorRegistry.GetOperator()

Retrieves the operator associated with the specified type parameter.

Rückgabe: The operator associated with the given type.

IsRegistered
public static bool IsRegistered(Type type)
result = OperatorRegistry.IsRegistered(type)

Checks if an operator is registered for the specified type.

type
The type to check for operator registration.

Rückgabe: true if an operator is registered; otherwise, false.

IsRegistered``1
public static bool IsRegistered<T>()
result = OperatorRegistry.IsRegistered()

Checks if an operator is registered for the specified type parameter.

Rückgabe: true if an operator is registered; otherwise, false.

RemoveOperator``1
public static void RemoveOperator<T>(IOperator<T> operator)
OperatorRegistry.RemoveOperator(operator)

Removes the operator for the specified type.

operator
The operator instance to remove.
ThrowIfNegative
public static long? ThrowIfNegative(long? value, string name)
result = OperatorRegistry.ThrowIfNegative(value, name)

Throws an exception if the specified nullable long value is negative.

value
The nullable long value to check.
name
The name of the variable to include in the exception.

Rückgabe: The original value if it is not negative; otherwise, null.

ThrowIfNegative
public static long ThrowIfNegative(long value, string name)
result = OperatorRegistry.ThrowIfNegative(value, name)

Throws an exception if the specified long value is negative.

value
The long value to check.
name
The name of the variable to include in the exception.

Rückgabe: The original value if it is not negative.