Class ExpressionBuilder
Provides extension methods to simplify construction of complex expressions.
Inherited Members
Namespace: DotNext.Linq.Expressions
Assembly: DotNext.Metaprogramming.dll
Syntax
public static class ExpressionBuilder
Methods
View SourceAndAlso(Expression, Expression)
Constructs binary expression that represents a conditional AND operation that evaluates the second operand only if the first operand evaluates to true.
Declaration
public static BinaryExpression AndAlso(this Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The first operand. |
| Expression | right | The second operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a && b.
AsDynamic(Expression?)
Converts expression to its dynamic representation that allows to construct expression trees using native language expressions.
Declaration
public static dynamic AsDynamic(this Expression? expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to be converted to dynamic expression builder. |
Returns
| Type | Description |
|---|---|
| dynamic | The dynamic representation of expression. |
AsResult(Expression)
Converts compound expression to its safe equivalent that doesn't throw exception and return Result<T> instead.
Declaration
public static Expression AsResult(this Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The compound expression. |
Returns
| Type | Description |
|---|---|
| Expression | The expression of type Result<T>. |
AsString(Expression)
Constructs expression that calls ToString().
Declaration
public static MethodCallExpression AsString(this Expression obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | obj | The object to be converted into string. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | The expression representing |
Assign(IndexExpression, Expression)
Constructs assignment expression.
Declaration
public static BinaryExpression Assign(this IndexExpression left, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | left | The assignee. |
| Expression | value | The value to be assigned to the left expression. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a.b[i] = c.
Assign(MemberExpression, Expression)
Constructs assignment expression.
Declaration
public static BinaryExpression Assign(this MemberExpression left, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | left | The assignee. |
| Expression | value | The value to be assigned to the left expression. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a.member = b.
Assign(ParameterExpression, Expression)
Constructs assignment expression.
Declaration
public static BinaryExpression Assign(this ParameterExpression left, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | left | The assignee. |
| Expression | value | The value to be assigned to the left expression. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a = b.
AssignDefault(IndexExpression)
Constructs assignment expression.
Declaration
public static BinaryExpression AssignDefault(this IndexExpression left)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | left | The assignee. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a.member[i] = default(T).
AssignDefault(MemberExpression)
Constructs assignment expression.
Declaration
public static BinaryExpression AssignDefault(this MemberExpression left)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | left | The assignee. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a.member = default(T).
AssignDefault(ParameterExpression)
Constructs assignment expression.
Declaration
public static BinaryExpression AssignDefault(this ParameterExpression left)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | left | The assignee. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a = default(T).
Await(Expression, bool)
Constructs suspension point in the execution of the lambda function until the awaited task completes.
Declaration
public static AwaitExpression Await(this Expression expression, bool configureAwait = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The awaitable expression. |
| bool | configureAwait | true to call ConfigureAwait(bool) with false argument. |
Returns
| Type | Description |
|---|---|
| AwaitExpression | await expression. |
Remarks
The equivalent code is await b.
See Also
View SourceBreak(LabelTarget)
Constructs loop leave statement.
Declaration
public static GotoExpression Break(this LabelTarget label)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label indicating loop exit. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Break statement. |
Remarks
The equivalent code is break.
Break(LabelTarget, Expression)
Constructs loop leave statement.
Declaration
public static GotoExpression Break(this LabelTarget label, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label indicating loop exit. |
| Expression | value | The value to be returned from loop. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Break statement. |
Call(Expression, MethodInfo, params Expression[])
Constructs instance method call expression.
Declaration
public static MethodCallExpression Call(this Expression instance, MethodInfo method, params Expression[] arguments)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| MethodInfo | method | The method to be called. |
| Expression[] | arguments | The method arguments. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | The method call expression. |
Remarks
The equivalent code is obj.Method(a, b,...).
Call(Expression, string, params Expression[])
Constructs instance method call expression.
Declaration
public static MethodCallExpression Call(this Expression instance, string methodName, params Expression[] arguments)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| string | methodName | The name of the method to be called. |
| Expression[] | arguments | The method arguments. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | The method call expression. |
Remarks
The equivalent code is obj.Method().
Call(Expression, Type, string, params Expression[])
Constructs interface or base class method call expression.
Declaration
public static MethodCallExpression Call(this Expression instance, Type interfaceType, string methodName, params Expression[] arguments)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| Type | interfaceType | The interface or base class. |
| string | methodName | The name of the method in the interface or base class to be called. |
| Expression[] | arguments | The method arguments. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | The method call expression. |
Remarks
The equivalent code is ((T)obj).Method().
CallStatic(Type, string, params Expression[])
Constructs static method call.
Declaration
public static MethodCallExpression CallStatic(this Type type, string methodName, params Expression[] arguments)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type that declares static method. |
| string | methodName | The name of the static method. |
| Expression[] | arguments | The arguments to be passed into static method. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | An expression representing static method call. |
Concat(Expression, params Expression[])
Constructs string concatenation expression.
Declaration
public static MethodCallExpression Concat(this Expression first, params Expression[] other)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | first | The first string to concatenate. |
| Expression[] | other | Other strings to concatenate. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | An expression presenting concatenation. |
Condition(Expression, Expression?, Expression?, Type?)
Constructs conditional expression.
Declaration
public static ConditionalExpression Condition(this Expression test, Expression? ifTrue = null, Expression? ifFalse = null, Type? type = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | test | Test expression. |
| Expression | ifTrue | Positive branch. |
| Expression | ifFalse | Negative branch. |
| Type | type | The type of conditional expression. Default is void. |
Returns
| Type | Description |
|---|---|
| ConditionalExpression | Conditional expression. |
Remarks
The equivalent code is a ? b : c.
Condition<TResult>(Expression, Expression, Expression)
Constructs conditional expression.
Declaration
public static ConditionalExpression Condition<TResult>(this Expression test, Expression ifTrue, Expression ifFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | test | Test expression. |
| Expression | ifTrue | Positive branch. |
| Expression | ifFalse | Negative branch. |
Returns
| Type | Description |
|---|---|
| ConditionalExpression | Conditional expression. |
Type Parameters
| Name | Description |
|---|---|
| TResult | The type of conditional expression. Default is void. |
Remarks
The equivalent code is a ? b : c.
Continue(LabelTarget)
Constructs loop continuation statement.
Declaration
public static GotoExpression Continue(this LabelTarget label)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label indicating loop start. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Continue statement. |
Convert(Expression, Type)
Constructs type conversion expression.
Declaration
public static UnaryExpression Convert(this Expression expression, Type targetType)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to be converted. |
| Type | targetType | The target type. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | The type conversion expression. |
Remarks
The equivalent code is (T)a.
Convert<T>(Expression)
Constructs type conversion expression.
Declaration
public static UnaryExpression Convert<T>(this Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to be converted. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | The type conversion expression. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type. |
Remarks
The equivalent code is (T)a.
ElementAt(Expression, ItemIndexExpression)
Constructs collection or array element access expression.
Declaration
public static CollectionAccessExpression ElementAt(this Expression collection, ItemIndexExpression index)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | collection | The collection. |
| ItemIndexExpression | index | The index of the collection or array element. |
Returns
| Type | Description |
|---|---|
| CollectionAccessExpression | The collection access expression. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
See Also
View SourceElementAt(Expression, params Expression[])
Constructs array element access expression.
Declaration
public static IndexExpression ElementAt(this Expression array, params Expression[] indices)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | array | The array expression. |
| Expression[] | indices | Array element indices. |
Returns
| Type | Description |
|---|---|
| IndexExpression | Array element access expression. |
Remarks
The equivalent code is a.b[i].
Equal(Expression, Expression)
Constructs equality comparison.
Declaration
public static BinaryExpression Equal(this Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a == b.
Field(Expression, FieldInfo)
Constructs instance field access expression.
Declaration
public static MemberExpression Field(this Expression instance, FieldInfo field)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| FieldInfo | field | Field metadata. |
Returns
| Type | Description |
|---|---|
| MemberExpression | Field access expression. |
Remarks
The equivalent code is a.b.
Field(Expression, string)
Constructs instance field access expression.
Declaration
public static MemberExpression Field(this Expression instance, string fieldName)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| string | fieldName | The name of the instance field. |
Returns
| Type | Description |
|---|---|
| MemberExpression | Field access expression. |
Remarks
The equivalent code is a.b.
Finally(Expression, Expression)
Constructs a try block with a finally block without catch block.
Declaration
public static TryExpression Finally(this Expression @try, Expression @finally)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | try |
|
| Expression | finally |
|
Returns
| Type | Description |
|---|---|
| TryExpression | Try-finally statement. |
Remarks
The equivalent code is try { } finally { }.
For(Expression, Condition, Iteration, Statement)
Creates for loop expression.
Declaration
public static ForExpression For(this Expression initialization, ForExpression.LoopBuilder.Condition condition, ForExpression.LoopBuilder.Iteration iteration, ForExpression.LoopBuilder.Statement body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | initialization | Loop variable initialization expression. |
| ForExpression.LoopBuilder.Condition | condition | The condition of loop continuation. |
| ForExpression.LoopBuilder.Iteration | iteration | The loop iteration statement. |
| ForExpression.LoopBuilder.Statement | body | The loop body. |
Returns
| Type | Description |
|---|---|
| ForExpression | The constructed loop. |
ForEach(Expression, Statement)
Creates foreach loop expression.
Declaration
public static ForEachExpression ForEach(this 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 constructed loop. |
Fragment<TDelegate>(Expression<TDelegate>, params Expression[])
Extracts body of lambda expression.
Declaration
public static Expression Fragment<TDelegate>(Expression<TDelegate> lambda, params Expression[] arguments) where TDelegate : MulticastDelegate
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<TDelegate> | lambda | The lambda expression. |
| Expression[] | arguments | The arguments used to replace lambda parameters. |
Returns
| Type | Description |
|---|---|
| Expression | The body of lambda expression. |
Type Parameters
| Name | Description |
|---|---|
| TDelegate | The type of the delegate describing lambda call site. |
Goto(LabelTarget)
Constructs unconditional control transfer statement.
Declaration
public static GotoExpression Goto(this LabelTarget label)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The declared label. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Unconditional control transfer statement. |
Remarks
The equivalent code is goto label.
Goto(LabelTarget, Expression)
Constructs unconditional control transfer expression.
Declaration
public static GotoExpression Goto(this LabelTarget label, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The declared label. |
| Expression | value | The value associated with the label. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Unconditional control transfer expression. |
IfNotNull(Expression, Func<ParameterExpression, Expression>)
Creates a new safe navigation expression.
Declaration
public static NullSafetyExpression IfNotNull(this 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. |
Index(int, bool)
Constructs expression of type Index.
Declaration
public static ItemIndexExpression Index(this int value, bool fromEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The expression representing index value. |
| bool | fromEnd | A boolean indicating if the index is from the start (false) or from the end (true) of a collection. |
Returns
| Type | Description |
|---|---|
| ItemIndexExpression | Index expression. |
Index(Expression, bool)
Constructs expression of type Index.
Declaration
public static ItemIndexExpression Index(this Expression value, bool fromEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | value | The expression representing index value. |
| bool | fromEnd | A boolean indicating if the index is from the start (false) or from the end (true) of a collection. |
Returns
| Type | Description |
|---|---|
| ItemIndexExpression | Index expression. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
Init(NewExpression, MemberBindings)
Constructs an expression representing initialization of members during object construction.
Declaration
public static MemberInitExpression Init(this NewExpression expression, MemberBindings bindings)
Parameters
| Type | Name | Description |
|---|---|---|
| NewExpression | expression | An expression representing object construction. |
| MemberBindings | bindings | A collection of members to initialize. |
Returns
| Type | Description |
|---|---|
| MemberInitExpression | Initialization expression. |
Remarks
The equivalent code is new T() { M1 = V1, M2 = V2 }.
InstanceOf(Expression, Type)
Constructs type check expression.
Declaration
public static TypeBinaryExpression InstanceOf(this Expression expression, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to test. |
| Type | type | The target type. |
Returns
| Type | Description |
|---|---|
| TypeBinaryExpression | The type test expression. |
Remarks
The equivalent code is a is T.
InstanceOf<T>(Expression)
Constructs type check expression.
Declaration
public static TypeBinaryExpression InstanceOf<T>(this Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to test. |
Returns
| Type | Description |
|---|---|
| TypeBinaryExpression | The type test expression. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type. |
Remarks
The equivalent code is a is T.
Invoke(Expression, params Expression[])
Constructs delegate invocation expression.
Declaration
public static InvocationExpression Invoke(this Expression @delegate, params Expression[] arguments)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | delegate | The expression representing delegate. |
| Expression[] | arguments | Invocation arguments. |
Returns
| Type | Description |
|---|---|
| InvocationExpression | Invocation expression. |
Remarks
The equivalent code is delegate.Invoke(a, b,...).
LandingSite(LabelTarget)
Constructs label landing site.
Declaration
public static LabelExpression LandingSite(this LabelTarget label)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label reference. |
Returns
| Type | Description |
|---|---|
| LabelExpression | The label landing site. |
Remarks
The equivalent code is label:.
LandingSite(LabelTarget, Expression)
Constructs label landing site with the default value.
Declaration
public static LabelExpression LandingSite(this LabelTarget label, Expression @default)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label reference. |
| Expression | default | The default value associated with the label. |
Returns
| Type | Description |
|---|---|
| LabelExpression | The label landing site. |
Lock(Expression, Statement)
Creates a new synchronized block of code.
Declaration
public static LockExpression Lock(this Expression syncRoot, LockExpression.Statement body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | syncRoot | The monitor object. |
| LockExpression.Statement | body | The delegate used to construct synchronized block of code. |
Returns
| Type | Description |
|---|---|
| LockExpression | The synchronized block of code. |
Loop(Expression)
Constructs loop statement.
Declaration
public static LoopExpression Loop(this Expression body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | body | The loop body. |
Returns
| Type | Description |
|---|---|
| LoopExpression | Loop statement. |
Loop(Expression, LabelTarget)
Constructs loop statement.
Declaration
public static LoopExpression Loop(this Expression body, LabelTarget @break)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | body | The loop body. |
| LabelTarget | break | Optional loop break label which will installed automatically. |
Returns
| Type | Description |
|---|---|
| LoopExpression | Loop statement. |
Loop(Expression, LabelTarget, LabelTarget)
Constructs loop statement.
Declaration
public static LoopExpression Loop(this Expression body, LabelTarget @break, LabelTarget @continue)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | body | The loop body. |
| LabelTarget | break | Optional loop break label which will installed automatically. |
| LabelTarget | continue | Optional loop continuation which will be installed automatically. |
Returns
| Type | Description |
|---|---|
| LoopExpression | Loop statement. |
New(Expression, params Expression[])
Constructs type instantiation expression.
Declaration
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(Activator))]
public static MethodCallExpression New(this Expression type, params Expression[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | type | The expression representing the type to be instantiated. |
| Expression[] | args | The list of arguments to be passed into constructor. |
Returns
| Type | Description |
|---|---|
| MethodCallExpression | Instantiation expression. |
Remarks
The equivalent code is new T().
New(Type, params Expression[])
Constructs type instantiation expression.
Declaration
public static NewExpression New(this Type type, params Expression[] args)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | |
| Expression[] | args | The list of arguments to be passed into constructor. |
Returns
| Type | Description |
|---|---|
| NewExpression | Instantiation expression. |
Remarks
The equivalent code is new T().
NotEqual(Expression, Expression)
Constructs inequality comparison.
Declaration
public static BinaryExpression NotEqual(this Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a != b.
NullCoalescingAssignment(IndexExpression, Expression)
Constructs null-coalescing assignment expression.
Declaration
public static NullCoalescingAssignmentExpression NullCoalescingAssignment(this IndexExpression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | left | The left operand of the assignment. |
| Expression | right | The right operand of the assignment. |
Returns
| Type | Description |
|---|---|
| NullCoalescingAssignmentExpression | The constructed expression. |
Remarks
The equivalent code is left.Member ??= right;.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
NullCoalescingAssignment(MemberExpression, Expression)
Constructs null-coalescing assignment expression.
Declaration
public static NullCoalescingAssignmentExpression NullCoalescingAssignment(this MemberExpression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | left | The left operand of the assignment. |
| Expression | right | The right operand of the assignment. |
Returns
| Type | Description |
|---|---|
| NullCoalescingAssignmentExpression | The constructed expression. |
Remarks
The equivalent code is left.Member ??= right;.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
NullCoalescingAssignment(ParameterExpression, Expression)
Constructs null-coalescing assignment expression.
Declaration
public static NullCoalescingAssignmentExpression NullCoalescingAssignment(this ParameterExpression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | left | The left operand of the assignment. |
| Expression | right | The right operand of the assignment. |
Returns
| Type | Description |
|---|---|
| NullCoalescingAssignmentExpression | The constructed expression. |
Remarks
The equivalent code is left ??= right;.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
OrElse(Expression, Expression)
Constructs binary expression that represents a conditional OR operation that evaluates the second operand only if the first operand evaluates to false.
Declaration
public static BinaryExpression OrElse(this Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The first operand. |
| Expression | right | The second operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a || b.
PostDecrementAssign(IndexExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent decrement by 1 of the original expression.
Declaration
public static UnaryExpression PostDecrementAssign(this IndexExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is a.b[i]--.
PostDecrementAssign(MemberExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent decrement by 1 of the original expression.
Declaration
public static UnaryExpression PostDecrementAssign(this MemberExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is a.b--.
PostDecrementAssign(ParameterExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent decrement by 1 of the original expression.
Declaration
public static UnaryExpression PostDecrementAssign(this ParameterExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is i--.
PostIncrementAssign(IndexExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent increment by 1 of the original expression.
Declaration
public static UnaryExpression PostIncrementAssign(this IndexExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is a.b[i]++.
PostIncrementAssign(MemberExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent increment by 1 of the original expression.
Declaration
public static UnaryExpression PostIncrementAssign(this MemberExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is a.b++.
PostIncrementAssign(ParameterExpression)
Constructs an expression that represents the assignment of given expression followed by a subsequent increment by 1 of the original expression.
Declaration
public static UnaryExpression PostIncrementAssign(this ParameterExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is i++.
Power(Expression, Expression)
Constructs raising a number to a power expression.
Declaration
public static BinaryExpression Power(this Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a ^ b in Visual Basic.
PreDecrementAssign(IndexExpression)
Constructs an expression that decrements given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreDecrementAssign(this IndexExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is --a.b[i].
PreDecrementAssign(MemberExpression)
Constructs an expression that decrements given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreDecrementAssign(this MemberExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is --a.b.
PreDecrementAssign(ParameterExpression)
Constructs an expression that decrements given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreDecrementAssign(this ParameterExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is --i.
PreIncrementAssign(IndexExpression)
Constructs an expression that increments given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreIncrementAssign(this IndexExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| IndexExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is ++a.b[i].
PreIncrementAssign(MemberExpression)
Constructs an expression that increments given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreIncrementAssign(this MemberExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is ++a.b.
PreIncrementAssign(ParameterExpression)
Constructs an expression that increments given expression by 1 and assigns the result back to the expression.
Declaration
public static UnaryExpression PreIncrementAssign(this ParameterExpression operand)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | operand | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is ++i.
Property(Expression, PropertyInfo)
Constructs instance property access expression.
Declaration
public static MemberExpression Property(this Expression instance, PropertyInfo property)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| PropertyInfo | property | Property metadata. |
Returns
| Type | Description |
|---|---|
| MemberExpression | Property access expression. |
Remarks
The equivalent code is a.b.
Property(Expression, PropertyInfo, Expression, params Expression[])
Constructs instance indexer access expression.
Declaration
public static IndexExpression Property(this Expression instance, PropertyInfo property, Expression index0, params Expression[] indices)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| PropertyInfo | property | Property metadata. |
| Expression | index0 | The first index. |
| Expression[] | indices | The rest of the indexer arguments. |
Returns
| Type | Description |
|---|---|
| IndexExpression | Property access expression. |
Remarks
The equivalent code is a.b[i].
Property(Expression, string)
Constructs instance property or indexer access expression.
Declaration
public static MemberExpression Property(this Expression instance, string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| string | propertyName | The name of the instance property. |
Returns
| Type | Description |
|---|---|
| MemberExpression | Property access expression. |
Remarks
The equivalent code is a.b.
Property(Expression, string, Expression, params Expression[])
Constructs instance property or indexer access expression.
Declaration
public static IndexExpression Property(this Expression instance, string propertyName, Expression index0, params Expression[] indices)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| string | propertyName | The name of the instance indexer. |
| Expression | index0 | The first index. |
| Expression[] | indices | The rest of the indexer arguments. |
Returns
| Type | Description |
|---|---|
| IndexExpression | Property access expression. |
Remarks
The equivalent code is a.b[i].
Property(Expression, Type, string)
Constructs instance property access expression declared in the given interface or base type.
Declaration
public static MemberExpression Property(this Expression instance, Type interfaceType, string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| Type | interfaceType | The interface or base class declaring property. |
| string | propertyName | The name of the instance property. |
Returns
| Type | Description |
|---|---|
| MemberExpression | Property access expression. |
Remarks
The equivalent code is a.b.
Property(Expression, Type, string, Expression, params Expression[])
Constructs instance property or indexer access expression declared in the given interface or base type.
Declaration
public static IndexExpression Property(this Expression instance, Type interfaceType, string propertyName, Expression index0, params Expression[] indices)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | instance |
|
| Type | interfaceType | The interface or base class declaring property. |
| string | propertyName | The name of the instance property or indexer. |
| Expression | index0 | The first index. |
| Expression[] | indices | The rest of the indexer arguments. |
Returns
| Type | Description |
|---|---|
| IndexExpression | Property access expression. |
Remarks
The equivalent code is a.b[i].
RefAnyVal(ParameterExpression, Type)
Creates a new expression that is equal to refanyval IL instruction.
Declaration
public static RefAnyValExpression RefAnyVal(this ParameterExpression typedRef, Type referenceType)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | typedRef | The variable of type TypedReference. |
| Type | referenceType | The type of the managed reference. |
Returns
| Type | Description |
|---|---|
| RefAnyValExpression | The expression representing statically typed referenced. |
RefAnyVal<T>(ParameterExpression)
Creates a new expression that is equal to refanyval IL instruction.
Declaration
public static RefAnyValExpression RefAnyVal<T>(this ParameterExpression typedRef)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterExpression | typedRef | The variable of type TypedReference. |
Returns
| Type | Description |
|---|---|
| RefAnyValExpression | The expression representing statically typed referenced. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the managed reference. |
Return(LabelTarget)
Constructs return statement.
Declaration
public static GotoExpression Return(this LabelTarget label)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label representing function exit. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Return statement. |
Remarks
The equivalent code is return.
Return(LabelTarget, Expression)
Constructs return statement with given value.
Declaration
public static GotoExpression Return(this LabelTarget label, Expression value)
Parameters
| Type | Name | Description |
|---|---|---|
| LabelTarget | label | The label representing function exit. |
| Expression | value | The value to be returned from function. |
Returns
| Type | Description |
|---|---|
| GotoExpression | Return statement. |
Remarks
The equivalent code is return a.
Slice(Expression, ItemIndexExpression?, ItemIndexExpression?)
Constructs slice of collection or array.
Declaration
public static SliceExpression Slice(this Expression collection, ItemIndexExpression? start = null, ItemIndexExpression? end = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | collection | The collection or array. |
| ItemIndexExpression | start | The first index of slice, inclusive. |
| ItemIndexExpression | end | The last index of slice, exclusive. |
Returns
| Type | Description |
|---|---|
| SliceExpression | The slice of collection or array. |
Slice(Expression, Expression)
Constructs slice of collection or array.
Declaration
public static SliceExpression Slice(this Expression collection, Expression range)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | collection | The collection or array. |
| Expression | range | The range of collection or array. |
Returns
| Type | Description |
|---|---|
| SliceExpression | The slice of collection or array. |
Throw(Expression, Type?)
Constructs throw expression.
Declaration
public static UnaryExpression Throw(this Expression exception, Type? type = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | exception | An exception to be thrown. |
| Type | type | The type of expression. Default is void. |
Returns
| Type | Description |
|---|---|
| UnaryExpression |
|
Remarks
The equivalent code is throw e.
To(ItemIndexExpression, ItemIndexExpression)
Constructs range.
Declaration
public static RangeExpression To(this ItemIndexExpression start, ItemIndexExpression end)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemIndexExpression | start | The inclusive start index of the range. |
| ItemIndexExpression | end | The exclusive end index of the range. |
Returns
| Type | Description |
|---|---|
| RangeExpression | The range expression. |
To(ItemIndexExpression, Index)
Constructs range.
Declaration
public static RangeExpression To(this ItemIndexExpression start, Index end)
Parameters
| Type | Name | Description |
|---|---|---|
| ItemIndexExpression | start | The inclusive start index of the range. |
| Index | end | The exclusive end index of the range. |
Returns
| Type | Description |
|---|---|
| RangeExpression | The range expression. |
TryConvert(Expression, Type)
Constructs an expression that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.
Declaration
public static UnaryExpression TryConvert(this Expression expression, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to convert. |
| Type | type | The target type. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Type conversion expression. |
Remarks
The equivalent code is a as T.
TryConvert<T>(Expression)
Constructs an expression that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.
Declaration
public static UnaryExpression TryConvert<T>(this Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The expression to convert. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Type conversion expression. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type. |
Remarks
The equivalent code is a as T.
Unbox(Expression, Type)
Constructs explicit unboxing.
Declaration
public static UnaryExpression Unbox(this Expression expression, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
| Type | type | The target value type. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unboxing expression. |
Remarks
The equivalent code is (T)b.
Unbox<T>(Expression)
Constructs explicit unboxing.
Declaration
public static UnaryExpression Unbox<T>(this Expression expression) where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unboxing expression. |
Type Parameters
| Name | Description |
|---|---|
| T | The target value type. |
Remarks
The equivalent code is (T)b.
Until(Expression, Statement)
Creates do{ }while() loop expression.
Declaration
public static WhileExpression Until(this Expression condition, WhileExpression.Statement body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | condition | The loop condition. |
| WhileExpression.Statement | body | The delegate that is used to construct loop body. |
Returns
| Type | Description |
|---|---|
| WhileExpression | The constructed loop expression. |
Remarks
The equivalent code is do { } while(condition).
See Also
View SourceUsing(Expression, Statement)
Creates block of code associated with disposable resource.
Declaration
public static UsingExpression Using(this 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. |
While(Expression, Statement)
Creates while loop expression.
Declaration
public static WhileExpression While(this Expression condition, WhileExpression.Statement body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | condition | The loop condition. |
| WhileExpression.Statement | body | The delegate that is used to construct loop body. |
Returns
| Type | Description |
|---|---|
| WhileExpression | The constructed loop expression. |
Remarks
The equivalent code is while(condition) { }.
See Also
View SourceWith(Expression, MemberBindings)
Creates a new instance of MutationExpression.
Declaration
public static MutationExpression With(this Expression obj, MemberBindings bindings)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | obj | An expression representing an object to copy. |
| MemberBindings | bindings | A collection of members to mutate. |
Returns
| Type | Description |
|---|---|
| MutationExpression | The constructed expression. |
See Also
View SourceWith(Expression, Statement)
Creates a new instance of WithExpression.
Declaration
public static WithExpression With(this Expression obj, WithExpression.Statement body)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | obj | The object to be referred inside of the body. |
| WithExpression.Statement | body | The body of the expression. |
Returns
| Type | Description |
|---|---|
| WithExpression | The constructed expression. |
See Also
View Sourceget_Breakpoint()
Gets a call to Break() as an expression tree.
Declaration
public static MethodCallExpression get_Breakpoint()
Returns
| Type | Description |
|---|---|
| MethodCallExpression |
get_CollectionLength(Expression)
Constructs expression representing count of items in the collection or string.
Declaration
public static Expression get_CollectionLength(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression |
Returns
| Type | Description |
|---|---|
| Expression | The expression providing access to the appropriate property indicating the number of items in the collection. |
Remarks
The input expression must be of type string, StringBuilder, array or any type implementing ICollection<T> or IReadOnlyCollection<T>.
get_DefaultExpr(Type)
Constructs type default value supplier.
Declaration
public static DefaultExpression get_DefaultExpr(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type |
Returns
| Type | Description |
|---|---|
| DefaultExpression | The type default value expression. |
Remarks
The equivalent code is default(T).
get_IsNotNull(Expression)
Constructs null check.
Declaration
public static Expression get_IsNotNull(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression |
Returns
| Type | Description |
|---|---|
| Expression | null check operation. |
Remarks
The equivalent code is !(a is null).
get_IsNull(Expression)
Constructs null check.
Declaration
public static Expression get_IsNull(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression |
Returns
| Type | Description |
|---|---|
| Expression | null check operation. |
Remarks
The equivalent code is a is null.
get_Nullable(Expression)
Converts value type to the expression of Nullable<T> type.
Declaration
public static Expression get_Nullable(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression |
Returns
| Type | Description |
|---|---|
| Expression | The nullable expression. |
Remarks
If expression is of pointer of reference type then
method returns unmodified expression.
get_Optional(Expression)
Creates the expression of Optional<T> type.
Declaration
public static Expression get_Optional(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression |
Returns
| Type | Description |
|---|---|
| Expression | The expression of Optional<T> type. |
get_Quoted(in Index)
Converts index to equivalent expression.
Declaration
public static ItemIndexExpression get_Quoted(in Index index)
Parameters
| Type | Name | Description |
|---|---|---|
| Index | index |
Returns
| Type | Description |
|---|---|
| ItemIndexExpression | Index expression. |
get_Quoted(in Range)
Converts range to equivalent expression.
Declaration
public static RangeExpression get_Quoted(in Range range)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | range |
Returns
| Type | Description |
|---|---|
| RangeExpression | The expression representing given range. |
get_Quoted<T>(T)
Converts arbitrary value into constant expression.
Declaration
public static ConstantExpression get_Quoted<T>(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value |
Returns
| Type | Description |
|---|---|
| ConstantExpression | The expression representing constant. |
Type Parameters
| Name | Description |
|---|---|
| T |
op_Addition(Expression, Expression)
Constructs binary arithmetic unchecked addition expression.
Declaration
public static BinaryExpression op_Addition(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a + b.
op_BitwiseAnd(Expression, Expression)
Constructs binary logical AND expression.
Declaration
public static BinaryExpression op_BitwiseAnd(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a & b.
op_BitwiseOr(Expression, Expression)
Constructs binary logical OR expression.
Declaration
public static BinaryExpression op_BitwiseOr(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a | b.
op_CheckedAddition(Expression, Expression)
Constructs binary arithmetic checked addition expression.
Declaration
public static BinaryExpression op_CheckedAddition(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is checked(a + b).
op_CheckedMultiply(Expression, Expression)
Constructs binary arithmetic checked multiplication expression.
Declaration
public static BinaryExpression op_CheckedMultiply(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is checked(a * b).
op_CheckedSubtraction(Expression, Expression)
Constructs binary arithmetic checked subtraction expression.
Declaration
public static BinaryExpression op_CheckedSubtraction(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is checked(a - b).
op_CheckedUnaryNegation(Expression)
Constructs checked negate expression.
Declaration
public static UnaryExpression op_CheckedUnaryNegation(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is checked(-a).
op_Division(Expression, Expression)
Constructs binary arithmetic division expression.
Declaration
public static BinaryExpression op_Division(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a / b.
op_ExclusiveOr(Expression, Expression)
Constructs binary logical exclusive OR expression.
Declaration
public static BinaryExpression op_ExclusiveOr(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a ^ b.
op_GreaterThan(Expression, Expression)
Constructs "greater than" numeric comparison.
Declaration
public static BinaryExpression op_GreaterThan(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a > b.
op_GreaterThanOrEqual(Expression, Expression)
Constructs "greater than or equal" numeric comparison.
Declaration
public static BinaryExpression op_GreaterThanOrEqual(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a >= b.
op_LeftShift(Expression, Expression)
Constructs bitwise left-shift expression.
Declaration
public static BinaryExpression op_LeftShift(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a << b in Visual Basic.
op_LessThan(Expression, Expression)
Constructs "less than" numeric comparison.
Declaration
public static BinaryExpression op_LessThan(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a < b.
op_LessThanOrEqual(Expression, Expression)
Constructs "less than or equal" numeric comparison.
Declaration
public static BinaryExpression op_LessThanOrEqual(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a <= b.
op_LogicalNot(Expression)
Constructs logical NOT expression.
Declaration
public static UnaryExpression op_LogicalNot(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is !a.
op_Modulus(Expression, Expression)
Constructs arithmetic remainder expression.
Declaration
public static BinaryExpression op_Modulus(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a % b.
op_Multiply(Expression, Expression)
Constructs binary arithmetic unchecked multiplication expression.
Declaration
public static BinaryExpression op_Multiply(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a * b.
op_OnesComplement(Expression)
Constructs ones complement.
Declaration
public static UnaryExpression op_OnesComplement(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is ~a.
op_RightShift(Expression, Expression)
Constructs bitwise right-shift expression.
Declaration
public static BinaryExpression op_RightShift(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a >> b in Visual Basic.
op_Subtraction(Expression, Expression)
Constructs binary arithmetic unchecked subtraction expression.
Declaration
public static BinaryExpression op_Subtraction(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| BinaryExpression | Binary expression. |
Remarks
The equivalent code is a - b.
op_UnaryNegation(Expression)
Constructs unchecked negate expression.
Declaration
public static UnaryExpression op_UnaryNegation(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is -a.
op_UnaryPlus(Expression)
Constructs unary plus expression.
Declaration
public static UnaryExpression op_UnaryPlus(Expression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | expression | The operand. |
Returns
| Type | Description |
|---|---|
| UnaryExpression | Unary expression. |
Remarks
The equivalent code is +a.
op_UnsignedRightShift(Expression, Expression)
Constructs bitwise unsigned right-shift expression.
Declaration
public static UnsignedRightShiftExpression op_UnsignedRightShift(Expression left, Expression right)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression | left | The left operand. |
| Expression | right | The right operand. |
Returns
| Type | Description |
|---|---|
| UnsignedRightShiftExpression | Binary expression. |
Remarks
The equivalent code is a >>> b in Visual Basic.