Class BaseOperator<T>
Provides a base implementation for arithmetic operators.
public abstract class BaseOperator<T> : IOperator<T>, IComparer<T>, IOperator, IComparer
Type Parameters
T
The type to operate on.
- Inheritance
-
BaseOperator<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseOperator()
protected BaseOperator()
Methods
Add(T, T)
Adds two values.
public abstract T Add(T first, T second)
Parameters
first
TThe first value.
second
TThe second value.
Returns
- T
The result of addition.
Compare(T, T)
Compares two values.
public abstract int Compare(T x, T y)
Parameters
x
TThe first value.
y
TThe second value.
Returns
- int
A value indicating the relative order.
Divide(T, T)
Divides the first value by the second.
public abstract T Divide(T first, T second)
Parameters
first
TThe first value.
second
TThe second value.
Returns
- T
The result of division.
Multiply(T, T)
Multiplies two values.
public abstract T Multiply(T first, T second)
Parameters
first
TThe first value.
second
TThe second value.
Returns
- T
The result of multiplication.
Subtract(T, T)
Subtracts the second value from the first.
public abstract T Subtract(T first, T second)
Parameters
first
TThe first value.
second
TThe second value.
Returns
- T
The result of subtraction.