Table of Contents

Class Variable

Namespace
xFunc.Maths.Expressions
Assembly
xFunc.Maths.dll

Represents variables in expressions.

public class Variable : IExpression, IEquatable<Variable>
Inheritance
Variable
Implements
Inherited Members
Extension Methods

Constructors

Variable(string)

Initializes a new instance of the Variable class.

public Variable(string name)

Parameters

name string

A name of variable.

Exceptions

ArgumentNullException

name is null or empty.

Fields

X

The 'x' variable.

public static readonly Variable X

Field Value

Variable

Y

The 'y' variable.

public static readonly Variable Y

Field Value

Variable

Properties

Name

Gets a name of this variable.

public string Name { get; }

Property Value

string

Methods

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 TContext

The context.

Returns

TResult

The analysis result.

Type Parameters

TResult

The type of the result.

TContext

The type of additional parameter for analyzer.

Deconstruct(out string)

Deconstructs Variable to string.

public void Deconstruct(out string variable)

Parameters

variable string

The name of variable.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(Variable?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Variable? other)

Parameters

other Variable

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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.

Exceptions

NotSupportedException

The evaluation of variable requires ExpressionParameters.

Execute(ExpressionParameters?)

Executes this expression.

public object Execute(ExpressionParameters? parameters)

Parameters

parameters ExpressionParameters

An object that contains all parameters and functions for expressions.

Returns

object

A result of the execution.

Exceptions

ArgumentNullException

parameters is null.

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 IFormatter

The formatter.

Returns

string

A string that represents this instance.

Operators

implicit operator Variable(string)

Defines an implicit conversion of a string object to a Variable object.

public static implicit operator Variable(string variable)

Parameters

variable string

The value to convert.

Returns

Variable

An object that contains the converted value.

implicit operator string(Variable?)

Defines an implicit conversion of a Variable object to a string object.

public static implicit operator string(Variable? variable)

Parameters

variable Variable

The value to convert.

Returns

string

An object that contains the converted value.

Exceptions

ArgumentNullException

variable is null.