Class UsingExpression
Represents using
or await using
expression.
Inherited Members
Namespace: DotNext.Linq.Expressions
Assembly: DotNext.Metaprogramming.dll
Syntax
public sealed class UsingExpression : CustomExpression
Properties
| Edit this page View SourceBody
Gets body of using
expression.
Declaration
public Expression Body { get; }
Property Value
Type | Description |
---|---|
Expression |
IsAwaitable
Indicates that this using
block is asynchronous.
Declaration
public bool IsAwaitable { get; }
Property Value
Type | Description |
---|---|
bool |
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 |
Overrides
Methods
| Edit this page View SourceCreate(Expression, Statement)
Creates a 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, bool, Statement)
Creates a block of code associated with asynchronously disposable resource.
Declaration
public static UsingExpression Create(Expression resource, bool configureAwait, UsingExpression.Statement body)
Parameters
Type | Name | Description |
---|---|---|
Expression | resource | The disposable resource. |
bool | configureAwait | true to call ConfigureAwait(bool) with false argument when awaiting DisposeAsync() method. |
UsingExpression.Statement | body | The delegate used to construct the block of code. |
Returns
Type | Description |
---|---|
UsingExpression | The constructed expression. |
See Also
| Edit this page View SourceCreate(Expression, bool, Expression)
Creates a block of code associated with asynchronously disposable resource.
Declaration
public static UsingExpression Create(Expression resource, bool configureAwait, Expression body)
Parameters
Type | Name | Description |
---|---|---|
Expression | resource | The disposable resource. |
bool | configureAwait | true to call ConfigureAwait(bool) with false argument when awaiting DisposeAsync() method. |
Expression | body | The body of the statement. |
Returns
Type | Description |
---|---|
UsingExpression | The constructed expression. |
See Also
| Edit this page View SourceCreate(Expression, Expression)
Creates a 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. |
Overrides
| Edit this page View SourceUpdate(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. |