Class ForEachExpression
Represents iteration over collection elements as expression.
Inherited Members
Namespace: DotNext.Linq.Expressions
Assembly: DotNext.Metaprogramming.dll
Syntax
public sealed class ForEachExpression : CustomExpression
Properties
| Edit this page View SourceBody
Gets loop body.
Declaration
public Expression Body { get; }
Property Value
Type | Description |
---|---|
Expression |
BreakLabel
Gets label that is used by the loop body as a break statement target.
Declaration
public LabelTarget BreakLabel { get; }
Property Value
Type | Description |
---|---|
LabelTarget |
ContinueLabel
Gets label that is used by the loop body as a continue statement target.
Declaration
public LabelTarget ContinueLabel { get; }
Property Value
Type | Description |
---|---|
LabelTarget |
Element
Gets collection element in the iteration.
Declaration
public MemberExpression Element { get; }
Property Value
Type | Description |
---|---|
MemberExpression |
IsAwaitable
Indicates that this expression represents enumeration over asynchronous collection.
Declaration
public bool IsAwaitable { get; }
Property Value
Type | Description |
---|---|
bool |
Type
Always returns void.
Declaration
public override Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Methods
| Edit this page View SourceCreate(Expression, Statement)
Creates a new loop expression.
Declaration
public static ForEachExpression Create(Expression collection, ForEachExpression.Statement body)
Parameters
Type | Name | Description |
---|---|---|
Expression | collection | The collection to iterate through. |
ForEachExpression.Statement | body | A delegate that is used to construct the body of the loop. |
Returns
Type | Description |
---|---|
ForEachExpression | The expression instance. |
Create(Expression, Expression)
Creates a new loop expression.
Declaration
public static ForEachExpression Create(Expression collection, Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | collection | The collection to iterate through. |
Expression | body | The body of the loop. |
Returns
Type | Description |
---|---|
ForEachExpression | The expression instance. |
Create(Expression, Expression, bool, Statement)
Creates asynchronous loop expression.
Declaration
public static ForEachExpression Create(Expression collection, Expression cancellationToken, bool configureAwait, ForEachExpression.Statement body)
Parameters
Type | Name | Description |
---|---|---|
Expression | collection | The collection to iterate through. |
Expression | cancellationToken | The expression of type CancellationToken. |
bool | configureAwait | true to call ConfigureAwait(bool) with false argument when awaiting MoveNextAsync() method. |
ForEachExpression.Statement | body | A delegate that is used to construct the body of the loop. |
Returns
Type | Description |
---|---|
ForEachExpression | The expression instance. |
See Also
| Edit this page View SourceCreate(Expression, Expression, bool, Expression)
Creates asynchronous loop expression.
Declaration
public static ForEachExpression Create(Expression collection, Expression cancellationToken, bool configureAwait, Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | collection | The collection to iterate through. |
Expression | cancellationToken | The expression of type CancellationToken. |
bool | configureAwait | true to call ConfigureAwait(bool) with false argument when awaiting MoveNextAsync() method. |
Expression | body | The body of the loop. |
Returns
Type | Description |
---|---|
ForEachExpression | The expression instance. |
See Also
| Edit this page View SourceReduce()
Translates this expression into predefined set of expressions using Lowering technique.
Declaration
public override Expression Reduce()
Returns
Type | Description |
---|---|
Expression | Translated expression. |