LiteralExpression Class

Represents a literal value expression (numbers, strings, booleans, null, etc.).

public class LiteralExpression : Expression

Example

var intLiteral = new LiteralExpression(42);
var stringLiteral = new LiteralExpression("Hello");
var boolLiteral = new LiteralExpression(true);
var nullLiteral = new LiteralExpression(null);

Assert.Equal("42", intLiteral.ToCsharpString());
Assert.Equal("\"Hello\"", stringLiteral.ToCsharpString());
Assert.Equal("true", boolLiteral.ToCsharpString());
Assert.Equal("null", nullLiteral.ToCsharpString());
Inheritance
Expression LiteralExpression

Constructors

NameDescription
LiteralExpression()
LiteralExpression(object?)Initializes a new instance of the LiteralExpression class with the specified value.

LiteralExpression overloads

LiteralExpression()

LiteralExpression.cs
public LiteralExpression()

No documentation is available.

LiteralExpression(object?)

LiteralExpression.cs

Initializes a new instance of the LiteralExpression class with the specified value.

public LiteralExpression(object? value)
Parameters
value object?
The literal value.

Properties

NameDescription
Value
public object? Value { get; set; }

Property value

object?

No documentation is available.