expression

< Back


Year

Namespace: Albatross.Expression.Prefix

Prefix expression that extracts the year component from a DateTime value. Returns an integer representing the year.

public class Year : PrefixExpression, Albatross.Expression.Nodes.IPrefixExpression, Albatross.Expression.Nodes.IExpression, Albatross.Expression.Nodes.IToken

Inheritance ObjectPrefixExpressionYear
Implements IPrefixExpression, IExpression, IToken

Properties

Name

The name of the prefix function.

public string Name { get; }

Property Value

String

Token

The token representation, which is the same as the Name.

public string Token { get; }

Property Value

String

MinOperandCount

The minimum number of operands this function requires.

public int MinOperandCount { get; }

Property Value

Int32

MaxOperandCount

The maximum number of operands this function accepts.

public int MaxOperandCount { get; }

Property Value

Int32

Operands

The list of operand expressions passed to this function.

public IReadOnlyList<IExpression> Operands { get; set; }

Property Value

IReadOnlyList<IExpression>

Constructors

Year()

Initializes a new instance of the Year class with name “Year” and exactly one parameter.

public Year()

Methods

Run(List<Object>)

Extracts the year component from the provided DateTime operand.

protected object Run(List<object> operands)

Parameters

operands List<Object>
List containing exactly one operand that can be converted to DateTime.

Returns

Object
An integer representing the year (e.g., 2024).

Exceptions

FormatException
Thrown when the operand cannot be converted to DateTime.


< Back