Class NullSafetyExpression
Represents expression that is protected by null check, e.g. safe navigation operator (?. in C#).
Namespace: DotNext.Linq.Expressions
Assembly: DotNext.Metaprogramming.dll
Syntax
public sealed class NullSafetyExpression : Expression
Properties
| Improve this Doc View SourceBody
Gets the body to be executed if Target is not null.
Declaration
public Expression Body { get; }
Property Value
Type | Description |
---|---|
Expression |
CanReduce
Always returns true because
this expression is
Declaration
public override bool CanReduce { get; }
Property Value
Type | Description |
---|---|
Boolean |
NodeType
Always returns
Declaration
public override ExpressionType NodeType { get; }
Property Value
Type | Description |
---|---|
ExpressionType |
Target
Gets expression augmented by null check.
Declaration
public ParameterExpression Target { get; }
Property Value
Type | Description |
---|---|
ParameterExpression |
Type
Gets type of this expression.
Declaration
public override Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
| Improve this Doc View SourceCreate(Expression, Func<ParameterExpression, Expression>)
Creates a new safe navigation expression.
Declaration
public static NullSafetyExpression Create(Expression target, Func<ParameterExpression, Expression> body)
Parameters
Type | Name | Description |
---|---|---|
Expression | target | The expression that is guarded by null check. |
Func<ParameterExpression, Expression> | body | The body to be executed if |
Returns
Type | Description |
---|---|
NullSafetyExpression | The expression representing safe navigation. |
Reduce()
Translates this expression into predefined set of expressions using Lowering technique.
Declaration
public override Expression Reduce()
Returns
Type | Description |
---|---|
Expression | Translated expression. |
Update(Expression)
Reconstructs expression with a new body.
Declaration
public NullSafetyExpression Update(Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | body | The new body of this expression. |
Returns
Type | Description |
---|---|
NullSafetyExpression | Updated expression. |