Class ExpressionValue
- Namespace
- combit.Expressions
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Represents the value of an expression with type support.
public class ExpressionValue : IEquatable<ExpressionValue>, IDisposable
- Inheritance
-
ExpressionValue
- Implements
- Inherited Members
Constructors
ExpressionValue()
Initializes a new instance of the ExpressionValue class.
public ExpressionValue()
ExpressionValue(Stream?, ExpressionType)
Initializes a new instance of the ExpressionValue class with a stream and a specified type.
public ExpressionValue(Stream? value, ExpressionType type)
Parameters
valueStreamThe stream value to assign to the expression.
typeExpressionTypeThe type of the expression.
ExpressionValue(bool?)
Initializes a new instance of the ExpressionValue class with a boolean value.
public ExpressionValue(bool? value)
Parameters
valuebool?The boolean value to assign to the expression.
ExpressionValue(DateTime?)
Initializes a new instance of the ExpressionValue class with a DateTime value.
public ExpressionValue(DateTime? value)
Parameters
valueDateTime?The DateTime value to assign to the expression.
ExpressionValue(double?)
Initializes a new instance of the ExpressionValue class with a double value.
public ExpressionValue(double? value)
Parameters
valuedouble?The double value to assign to the expression.
ExpressionValue(int?)
Initializes a new instance of the ExpressionValue class with an integer value.
public ExpressionValue(int? value)
Parameters
valueint?The double value to assign to the expression.
ExpressionValue(string?)
Initializes a new instance of the ExpressionValue class with a string value.
public ExpressionValue(string? value)
Parameters
valuestringThe string value to assign to the expression.
ExpressionValue(string?, ExpressionType)
Initializes a new instance of the ExpressionValue class with a string value and a specified type.
public ExpressionValue(string? value, ExpressionType type)
Parameters
valuestringThe string value to assign to the expression.
typeExpressionTypeThe type of the expression.
Properties
ExpressionType
Gets or sets the type of the expression.
public ExpressionType ExpressionType { get; set; }
Property Value
IsConstant
Gets or sets a value indicating whether the expression value is constant.
public bool IsConstant { get; }
Property Value
IsInteger
Gets or sets a value indicating whether the expression value is an integer.
public bool IsInteger { get; }
Property Value
IsNull
Gets a value indicating whether the expression is null.
public virtual bool IsNull { get; }
Property Value
Methods
AsBoolean()
Returns the boolean value if the expression is of type Boolean.
public virtual bool? AsBoolean()
Returns
- bool?
The boolean value, or null if not applicable.
AsDateTime(bool)
Returns the DateTime value if the expression is of type Date.
public virtual DateTime? AsDateTime(bool convertToClient = false)
Parameters
convertToClientboolIf true, converts the DateTime to client time; otherwise, returns the normalized DateTime.
Returns
- DateTime?
The DateTime value, or null if not applicable.
AsDouble()
Returns the double value if the expression is of type Double.
public virtual double? AsDouble()
Returns
- double?
The double value, or null if not applicable.
AsInt()
Returns the integer value (rounded from double) if the expression is of type Double.
public virtual int? AsInt()
Returns
- int?
The integer value, or null if not applicable.
AsStream()
Returns the stream value if the expression is of type Drawing.
public virtual Stream? AsStream()
Returns
- Stream
The stream value, or null if not applicable.
AsString()
Returns the string value if the expression is of type String.
public virtual string? AsString()
Returns
- string
The string value, or null if not applicable.
Dispose()
Releases the resources used by the ExpressionValue instance.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the ExpressionValue and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingboolTrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Equals(object?)
Determines whether the specified object is equal to the current ExpressionValue.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current ExpressionValue.
Returns
- bool
True if the specified object is equal to the current object; otherwise, false.
Equals(ExpressionValue?)
Determines whether the specified ExpressionValue is equal to the current ExpressionValue.
public virtual bool Equals(ExpressionValue? other)
Parameters
otherExpressionValueThe ExpressionValue to compare with the current ExpressionValue.
Returns
- bool
True if the specified ExpressionValue is equal to the current one; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current ExpressionValue.
IncrementBy(int)
Increments the integer value of the expression by the given offset.
public ExpressionValue IncrementBy(int offset)
Parameters
offsetintThe offset by which to increment the integer value.
Returns
- ExpressionValue
A new ExpressionValue with the incremented value.
Exceptions
- NotSupportedException
Thrown if the expression is not an integer.
ToString()
Returns a string that represents the current object.
public override string? ToString()
Returns
- string
A string that represents the current ExpressionValue.
Operators
operator +(ExpressionValue, ExpressionValue)
Adds two ExpressionValue instances.
public static ExpressionValue operator +(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- ExpressionValue
A new ExpressionValue representing the sum.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator /(ExpressionValue, ExpressionValue)
Divides one ExpressionValue by another.
public static ExpressionValue operator /(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- ExpressionValue
A new ExpressionValue representing the result of the division.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator ==(ExpressionValue, ExpressionValue)
Determines if two ExpressionValue instances are equal.
public static bool operator ==(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the operands are equal; otherwise, false.
operator >(ExpressionValue, ExpressionValue)
Determines if one ExpressionValue is greater than another.
public static bool operator >(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the left operand is greater than the right operand; otherwise, false.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator >=(ExpressionValue, ExpressionValue)
Determines if one ExpressionValue is greater than or equal to another.
public static bool operator >=(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the left operand is greater than or equal to the right operand; otherwise, false.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator !=(ExpressionValue?, ExpressionValue?)
Determines if two ExpressionValue instances are not equal.
public static bool operator !=(ExpressionValue? left, ExpressionValue? right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the operands are not equal; otherwise, false.
operator <(ExpressionValue, ExpressionValue)
Determines if one ExpressionValue is less than another.
public static bool operator <(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the left operand is less than the right operand; otherwise, false.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator <=(ExpressionValue, ExpressionValue)
Determines if one ExpressionValue is less than or equal to another.
public static bool operator <=(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- bool
True if the left operand is less than or equal to the right operand; otherwise, false.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator %(ExpressionValue, ExpressionValue)
Computes the modulus of two ExpressionValue instances.
public static ExpressionValue operator %(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- ExpressionValue
A new ExpressionValue representing the modulus.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator *(ExpressionValue, ExpressionValue)
Multiplies two ExpressionValue instances.
public static ExpressionValue operator *(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- ExpressionValue
A new ExpressionValue representing the product.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.
operator -(ExpressionValue, ExpressionValue)
Subtracts one ExpressionValue from another.
public static ExpressionValue operator -(ExpressionValue left, ExpressionValue right)
Parameters
leftExpressionValueThe left-hand operand.
rightExpressionValueThe right-hand operand.
Returns
- ExpressionValue
A new ExpressionValue representing the result of the subtraction.
Exceptions
- ListLabelException
Thrown if the operand types are incompatible or unsupported.