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 Object → PrefixExpression → Year
Implements IPrefixExpression, IExpression, IToken
The name of the prefix function.
public string Name { get; }
The token representation, which is the same as the Name.
public string Token { get; }
The minimum number of operands this function requires.
public int MinOperandCount { get; }
The maximum number of operands this function accepts.
public int MaxOperandCount { get; }
The list of operand expressions passed to this function.
public IReadOnlyList<IExpression> Operands { get; set; }
Initializes a new instance of the Year class with name “Year” and exactly one parameter.
public Year()
Extracts the year component from the provided DateTime operand.
protected object Run(List<object> operands)
operands
List<Object>
List containing exactly one operand that can be converted to DateTime.
Object
An integer representing the year (e.g., 2024).
!:FormatException
Thrown when the operand cannot be converted to DateTime.