Struct ExpressionExtensions.ForEachLoopExpressionCreator
- Namespace
- LfrlAnvil.Extensions
- Assembly
- LfrlAnvil.Core.dll
A lightweight creator of an Expression node equivalent to a foreach loop.
public readonly struct ExpressionExtensions.ForEachLoopExpressionCreator
- Inherited Members
- Extension Methods
Properties
Current
ParameterExpression representing a local variable that can have the Current value assigned to it.
public ParameterExpression Current { get; }
Property Value
CurrentAssignment
BinaryExpression representing an assignment of the Current value to the Current local variable.
public BinaryExpression CurrentAssignment { get; }
Property Value
CurrentProperty
PropertyInfo instance representing enumerator's Current property.
public PropertyInfo CurrentProperty { get; }
Property Value
Methods
Create(Expression, string?)
Creates a new BlockExpression that represents a foreach loop.
[Pure]
public BlockExpression Create(Expression body, string? loopBreakLabelName = "ForEachEnd")
Parameters
body
ExpressionLoop's body expression.
loopBreakLabelName
stringOptional name of the LabelTarget that represents the loop's break. Equal to "ForEachEnd" by default.
Returns
- BlockExpression
New BlockExpression instance.
Remarks
Use Current and CurrentAssignment properties to construct the desired loop body.