Class Unit<T>
- Namespace
- xFunc.Maths.Expressions.Units
- Assembly
- xFunc.Maths.dll
Represents an expression that contains unit number.
public abstract class Unit<T> : IExpression, IEquatable<Unit<T>> where T : struct, IEquatable<T>
Type Parameters
T
The type of unit.
- Inheritance
-
Unit<T>
- Implements
-
IEquatable<Unit<T>>
- Derived
- Inherited Members
- Extension Methods
Constructors
Unit(T)
Initializes a new instance of the Unit<T> class.
protected Unit(T value)
Parameters
value
TA unit number.
Properties
Value
Gets a value.
public T Value { get; }
Property Value
- T
Methods
AnalyzeInternal<TResult>(IAnalyzer<TResult>)
Analyzes the current expression.
protected abstract TResult AnalyzeInternal<TResult>(IAnalyzer<TResult> analyzer)
Parameters
analyzer
IAnalyzer<TResult>The analyzer.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
AnalyzeInternal<TResult, TContext>(IAnalyzer<TResult, TContext>, TContext)
Analyzes the current expression.
protected abstract TResult AnalyzeInternal<TResult, TContext>(IAnalyzer<TResult, TContext> analyzer, TContext context)
Parameters
analyzer
IAnalyzer<TResult, TContext>The analyzer.
context
TContextThe context.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
TContext
The type of additional parameter for analyzer.
Analyze<TResult>(IAnalyzer<TResult>)
Analyzes the current expression.
public TResult Analyze<TResult>(IAnalyzer<TResult> analyzer)
Parameters
analyzer
IAnalyzer<TResult>The analyzer.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
Analyze<TResult, TContext>(IAnalyzer<TResult, TContext>, TContext)
Analyzes the current expression.
public TResult Analyze<TResult, TContext>(IAnalyzer<TResult, TContext> analyzer, TContext context)
Parameters
analyzer
IAnalyzer<TResult, TContext>The analyzer.
context
TContextThe context.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
TContext
The type of additional parameter for analyzer.
Deconstruct(out T)
Deconstructs Unit<T> to T
.
public void Deconstruct(out T value)
Parameters
value
TThe angle.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Equals(Unit<T>?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Unit<T>? other)
Parameters
other
Unit<T>An object to compare with this object.
Returns
Execute()
Executes this expression. Don't use this method if your expression has variables or user-functions.
public object Execute()
Returns
- object
A result of the execution.
Execute(ExpressionParameters?)
Executes this expression.
public object Execute(ExpressionParameters? parameters)
Parameters
parameters
ExpressionParametersAn object that contains all parameters and functions for expressions.
Returns
- object
A result of the execution.
- See Also
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(IFormatter)
Returns a string that represents this instance.
public string ToString(IFormatter formatter)
Parameters
formatter
IFormatterThe formatter.