Path: redb-route/redb.Route/Expressions/Ast/TernaryNode.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Expressions/Ast/TernaryNode.cs
----
using redb.Route.Abstractions;
namespace redb.Route.Expressions.Ast;
///
/// AST node representing a ternary conditional expression (condition ? ifTrue : ifFalse).
///
public class TernaryNode : AstNode
{
///
/// Gets the condition expression.
///
public AstNode Condition { get; }
///
/// Gets the expression evaluated when the condition is true.
///
public AstNode IfTrue { get; }
///
/// Gets the expression evaluated when the condition is false.
///
public AstNode IfFalse { get; }
///
/// Initializes a new instance of the class.
///
/// The condition node.
/// The node evaluated when condition is true.
/// The node evaluated when condition is false.
public TernaryNode(AstNode condition, AstNode ifTrue, AstNode ifFalse)
{
Condition = condition;
IfTrue = ifTrue;
IfFalse = ifFalse;
}
///
public override string ToString() => $"({Condition} ? {IfTrue} : {IfFalse})";
}