Class UsingExpression
Represents using
expression.
Namespace: DotNext.Linq.Expressions
Assembly: DotNext.Metaprogramming.dll
Syntax
public sealed class UsingExpression : Expression
Properties
| Improve this Doc View SourceBody
Gets body of using
expression.
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 |
Resource
Gets the variable holding the disposable resource.
Declaration
public ParameterExpression Resource { get; }
Property Value
Type | Description |
---|---|
ParameterExpression |
Type
Gets the type of this expression.
Declaration
public override Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
| Improve this Doc View SourceCreate(Expression, UsingExpression.Statement)
Creates block of code associated with disposable resource.
Declaration
public static UsingExpression Create(Expression resource, UsingExpression.Statement body)
Parameters
Type | Name | Description |
---|---|---|
Expression | resource | The disposable resource. |
UsingExpression.Statement | body | The delegate used to construct the block of code. |
Returns
Type | Description |
---|---|
UsingExpression | The constructed expression. |
Create(Expression, Expression)
Creates block of code associated with disposable resource.
Declaration
public static UsingExpression Create(Expression resource, Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | resource | The disposable resource. |
Expression | body | The body of the statement. |
Returns
Type | Description |
---|---|
UsingExpression | The constructed expression. |
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 UsingExpression Update(Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | body | The new body of this expression. |
Returns
Type | Description |
---|---|
UsingExpression | Updated expression. |