OperatorRegistry
Provides a registry for operators to perform mathematical and comparison operations.
Конструкторы
private OperatorRegistry()
operatorRegistry = OperatorRegistry()
Initializes static members of the OperatorRegistry class. Registers the default set of operators.
Методы
public static void AddOperator<T>(IOperator<T> operator)
OperatorRegistry.AddOperator(operator)
Adds an operator for the specified type.
- operator
- The operator to add.
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.
Возвращает: The operator associated with the given type.
public static IOperator<T> GetOperator<T>()
result = OperatorRegistry.GetOperator()
Retrieves the operator associated with the specified type parameter.
Возвращает: The operator associated with the given type.
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.
Возвращает: true if an operator is registered; otherwise, false.
public static bool IsRegistered<T>()
result = OperatorRegistry.IsRegistered()
Checks if an operator is registered for the specified type parameter.
Возвращает: true if an operator is registered; otherwise, false.
public static void RemoveOperator<T>(IOperator<T> operator)
OperatorRegistry.RemoveOperator(operator)
Removes the operator for the specified type.
- operator
- The operator instance to remove.
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.
Возвращает: The original value if it is not negative; otherwise, null.
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.
Возвращает: The original value if it is not negative.