This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,825 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an expression that has a binary operator.</summary>
// Token: 0x02000015 RID: 21
public sealed class BinaryExpression : Expression
{
// Token: 0x06000131 RID: 305 RVA: 0x000077B4 File Offset: 0x000059B4
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right)
: base(node_type, type)
{
this.left = left;
this.right = right;
}
// Token: 0x06000132 RID: 306 RVA: 0x000077D0 File Offset: 0x000059D0
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right, MethodInfo method)
: base(node_type, type)
{
this.left = left;
this.right = right;
this.method = method;
}
// Token: 0x06000133 RID: 307 RVA: 0x000077F4 File Offset: 0x000059F4
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right, bool lift_to_null, bool is_lifted, MethodInfo method, LambdaExpression conversion)
: base(node_type, type)
{
this.left = left;
this.right = right;
this.method = method;
this.conversion = conversion;
this.lift_to_null = lift_to_null;
this.is_lifted = is_lifted;
}
/// <summary>Gets the left operand of the binary operation.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand of the binary operation.</returns>
// Token: 0x17000011 RID: 17
// (get) Token: 0x06000134 RID: 308 RVA: 0x00007830 File Offset: 0x00005A30
public Expression Left
{
get
{
return this.left;
}
}
/// <summary>Gets the right operand of the binary operation.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand of the binary operation.</returns>
// Token: 0x17000012 RID: 18
// (get) Token: 0x06000135 RID: 309 RVA: 0x00007838 File Offset: 0x00005A38
public Expression Right
{
get
{
return this.right;
}
}
/// <summary>Gets the implementing method for the binary operation.</summary>
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</returns>
// Token: 0x17000013 RID: 19
// (get) Token: 0x06000136 RID: 310 RVA: 0x00007840 File Offset: 0x00005A40
public MethodInfo Method
{
get
{
return this.method;
}
}
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator.</summary>
/// <returns>true if the node represents a lifted call; otherwise, false.</returns>
// Token: 0x17000014 RID: 20
// (get) Token: 0x06000137 RID: 311 RVA: 0x00007848 File Offset: 0x00005A48
public bool IsLifted
{
get
{
return this.is_lifted;
}
}
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type.</summary>
/// <returns>true if the operator's return type is lifted to a nullable type; otherwise, false.</returns>
// Token: 0x17000015 RID: 21
// (get) Token: 0x06000138 RID: 312 RVA: 0x00007850 File Offset: 0x00005A50
public bool IsLiftedToNull
{
get
{
return this.lift_to_null;
}
}
/// <summary>Gets the type conversion function that is used by a coalescing operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that represents a type conversion function.</returns>
// Token: 0x17000016 RID: 22
// (get) Token: 0x06000139 RID: 313 RVA: 0x00007858 File Offset: 0x00005A58
public LambdaExpression Conversion
{
get
{
return this.conversion;
}
}
// Token: 0x0600013A RID: 314 RVA: 0x00007860 File Offset: 0x00005A60
private void EmitArrayAccess(EmitContext ec)
{
this.left.Emit(ec);
this.right.Emit(ec);
ec.ig.Emit(OpCodes.Ldelem, base.Type);
}
// Token: 0x0600013B RID: 315 RVA: 0x0000789C File Offset: 0x00005A9C
private void EmitLogicalBinary(EmitContext ec)
{
ExpressionType nodeType = base.NodeType;
if (nodeType != ExpressionType.And)
{
if (nodeType != ExpressionType.AndAlso)
{
if (nodeType == ExpressionType.Or)
{
goto IL_2A;
}
if (nodeType != ExpressionType.OrElse)
{
return;
}
}
if (!this.IsLifted)
{
this.EmitLogicalShortCircuit(ec);
}
else
{
this.EmitLiftedLogicalShortCircuit(ec);
}
return;
}
IL_2A:
if (!this.IsLifted)
{
this.EmitLogical(ec);
}
else if (base.Type == typeof(bool?))
{
this.EmitLiftedLogical(ec);
}
else
{
this.EmitLiftedArithmeticBinary(ec);
}
}
// Token: 0x0600013C RID: 316 RVA: 0x0000793C File Offset: 0x00005B3C
private void EmitLogical(EmitContext ec)
{
this.EmitNonLiftedBinary(ec);
}
// Token: 0x0600013D RID: 317 RVA: 0x00007948 File Offset: 0x00005B48
private void EmitLiftedLogical(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = base.NodeType == ExpressionType.And;
LocalBuilder localBuilder = ec.EmitStored(this.left);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
Label label3 = ig.DefineLabel();
ec.EmitNullableGetValueOrDefault(localBuilder);
ig.Emit(OpCodes.Brtrue, label);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ig.Emit(OpCodes.Brtrue, label2);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label);
ig.MarkLabel(label2);
ec.EmitLoad((!flag) ? localBuilder2 : localBuilder);
ig.Emit(OpCodes.Br, label3);
ig.MarkLabel(label);
ec.EmitLoad((!flag) ? localBuilder : localBuilder2);
ig.MarkLabel(label3);
}
// Token: 0x0600013E RID: 318 RVA: 0x00007A20 File Offset: 0x00005C20
private void EmitLogicalShortCircuit(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = base.NodeType == ExpressionType.AndAlso;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
ec.Emit(this.left);
ig.Emit((!flag) ? OpCodes.Brtrue : OpCodes.Brfalse, label);
ec.Emit(this.right);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
ig.Emit((!flag) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
ig.MarkLabel(label2);
}
// Token: 0x0600013F RID: 319 RVA: 0x00007AB8 File Offset: 0x00005CB8
private MethodInfo GetFalseOperator()
{
return Expression.GetFalseOperator(this.left.Type.GetNotNullableType());
}
// Token: 0x06000140 RID: 320 RVA: 0x00007AD0 File Offset: 0x00005CD0
private MethodInfo GetTrueOperator()
{
return Expression.GetTrueOperator(this.left.Type.GetNotNullableType());
}
// Token: 0x06000141 RID: 321 RVA: 0x00007AE8 File Offset: 0x00005CE8
private void EmitUserDefinedLogicalShortCircuit(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = base.NodeType == ExpressionType.AndAlso;
Label label = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
ec.EmitLoad(localBuilder);
ig.Emit(OpCodes.Dup);
ec.EmitCall((!flag) ? this.GetTrueOperator() : this.GetFalseOperator());
ig.Emit(OpCodes.Brtrue, label);
ec.Emit(this.right);
ec.EmitCall(this.method);
ig.MarkLabel(label);
}
// Token: 0x06000142 RID: 322 RVA: 0x00007B74 File Offset: 0x00005D74
private void EmitLiftedLogicalShortCircuit(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = base.NodeType == ExpressionType.AndAlso;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
Label label3 = ig.DefineLabel();
Label label4 = ig.DefineLabel();
Label label5 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label);
ec.EmitNullableGetValueOrDefault(localBuilder);
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
ig.Emit((!flag) ? OpCodes.Brfalse : OpCodes.Brtrue, label2);
ig.MarkLabel(label);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
ec.EmitNullableHasValue(localBuilder2);
ig.Emit(OpCodes.Brfalse_S, label3);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
ig.Emit((!flag) ? OpCodes.Brfalse : OpCodes.Brtrue, label2);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label3);
ig.Emit((!flag) ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
ig.Emit(OpCodes.Br_S, label4);
ig.MarkLabel(label2);
ig.Emit((!flag) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
ig.MarkLabel(label4);
ec.EmitNullableNew(base.Type);
ig.Emit(OpCodes.Br, label5);
ig.MarkLabel(label3);
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
ec.EmitNullableInitialize(localBuilder3);
ig.MarkLabel(label5);
}
// Token: 0x06000143 RID: 323 RVA: 0x00007D20 File Offset: 0x00005F20
private void EmitCoalesce(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
bool flag = localBuilder.LocalType.IsNullable();
if (flag)
{
ec.EmitNullableHasValue(localBuilder);
}
else
{
ec.EmitLoad(localBuilder);
}
ig.Emit(OpCodes.Brfalse, label2);
if (flag && !base.Type.IsNullable())
{
ec.EmitNullableGetValue(localBuilder);
}
else
{
ec.EmitLoad(localBuilder);
}
ig.Emit(OpCodes.Br, label);
ig.MarkLabel(label2);
ec.Emit(this.right);
ig.MarkLabel(label);
}
// Token: 0x06000144 RID: 324 RVA: 0x00007DD4 File Offset: 0x00005FD4
private void EmitConvertedCoalesce(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
if (localBuilder.LocalType.IsNullable())
{
ec.EmitNullableHasValue(localBuilder);
}
else
{
ec.EmitLoad(localBuilder);
}
ig.Emit(OpCodes.Brfalse, label2);
ec.Emit(this.conversion);
ec.EmitLoad(localBuilder);
ig.Emit(OpCodes.Callvirt, this.conversion.Type.GetInvokeMethod());
ig.Emit(OpCodes.Br, label);
ig.MarkLabel(label2);
ec.Emit(this.right);
ig.MarkLabel(label);
}
// Token: 0x06000145 RID: 325 RVA: 0x00007E88 File Offset: 0x00006088
private static bool IsInt32OrInt64(Type type)
{
return type == typeof(int) || type == typeof(long);
}
// Token: 0x06000146 RID: 326 RVA: 0x00007EB8 File Offset: 0x000060B8
private static bool IsSingleOrDouble(Type type)
{
return type == typeof(float) || type == typeof(double);
}
// Token: 0x06000147 RID: 327 RVA: 0x00007EE8 File Offset: 0x000060E8
private void EmitBinaryOperator(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = Expression.IsUnsigned(this.left.Type);
ExpressionType nodeType = base.NodeType;
switch (nodeType)
{
case ExpressionType.Divide:
ig.Emit((!flag) ? OpCodes.Div : OpCodes.Div_Un);
break;
case ExpressionType.Equal:
ig.Emit(OpCodes.Ceq);
break;
case ExpressionType.ExclusiveOr:
ig.Emit(OpCodes.Xor);
break;
case ExpressionType.GreaterThan:
ig.Emit((!flag) ? OpCodes.Cgt : OpCodes.Cgt_Un);
break;
case ExpressionType.GreaterThanOrEqual:
if (flag || BinaryExpression.IsSingleOrDouble(this.left.Type))
{
ig.Emit(OpCodes.Clt_Un);
}
else
{
ig.Emit(OpCodes.Clt);
}
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
break;
default:
switch (nodeType)
{
case ExpressionType.Add:
ig.Emit(OpCodes.Add);
break;
case ExpressionType.AddChecked:
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
{
ig.Emit(OpCodes.Add_Ovf);
}
else
{
ig.Emit((!flag) ? OpCodes.Add : OpCodes.Add_Ovf_Un);
}
break;
case ExpressionType.And:
ig.Emit(OpCodes.And);
break;
default:
throw new InvalidOperationException(string.Format("Internal error: BinaryExpression contains non-Binary nodetype {0}", base.NodeType));
}
break;
case ExpressionType.LeftShift:
case ExpressionType.RightShift:
ig.Emit(OpCodes.Ldc_I4, (this.left.Type != typeof(int)) ? 63 : 31);
ig.Emit(OpCodes.And);
if (base.NodeType == ExpressionType.RightShift)
{
ig.Emit((!flag) ? OpCodes.Shr : OpCodes.Shr_Un);
}
else
{
ig.Emit(OpCodes.Shl);
}
break;
case ExpressionType.LessThan:
ig.Emit((!flag) ? OpCodes.Clt : OpCodes.Clt_Un);
break;
case ExpressionType.LessThanOrEqual:
if (flag || BinaryExpression.IsSingleOrDouble(this.left.Type))
{
ig.Emit(OpCodes.Cgt_Un);
}
else
{
ig.Emit(OpCodes.Cgt);
}
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
break;
case ExpressionType.Modulo:
ig.Emit((!flag) ? OpCodes.Rem : OpCodes.Rem_Un);
break;
case ExpressionType.Multiply:
ig.Emit(OpCodes.Mul);
break;
case ExpressionType.MultiplyChecked:
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
{
ig.Emit(OpCodes.Mul_Ovf);
}
else
{
ig.Emit((!flag) ? OpCodes.Mul : OpCodes.Mul_Ovf_Un);
}
break;
case ExpressionType.NotEqual:
ig.Emit(OpCodes.Ceq);
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
break;
case ExpressionType.Or:
ig.Emit(OpCodes.Or);
break;
case ExpressionType.Power:
ig.Emit(OpCodes.Call, typeof(Math).GetMethod("Pow"));
break;
case ExpressionType.Subtract:
ig.Emit(OpCodes.Sub);
break;
case ExpressionType.SubtractChecked:
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
{
ig.Emit(OpCodes.Sub_Ovf);
}
else
{
ig.Emit((!flag) ? OpCodes.Sub : OpCodes.Sub_Ovf_Un);
}
break;
}
}
// Token: 0x06000148 RID: 328 RVA: 0x000082F0 File Offset: 0x000064F0
private bool IsLeftLiftedBinary()
{
return this.left.Type.IsNullable() && !this.right.Type.IsNullable();
}
// Token: 0x06000149 RID: 329 RVA: 0x00008328 File Offset: 0x00006528
private void EmitLeftLiftedToNullBinary(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.Emit(this.right);
this.EmitBinaryOperator(ec);
ec.EmitNullableNew(base.Type);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
ec.EmitNullableInitialize(localBuilder2);
ig.MarkLabel(label2);
}
// Token: 0x0600014A RID: 330 RVA: 0x000083C0 File Offset: 0x000065C0
private void EmitLiftedArithmeticBinary(EmitContext ec)
{
if (this.IsLeftLiftedBinary())
{
this.EmitLeftLiftedToNullBinary(ec);
}
else
{
this.EmitLiftedToNullBinary(ec);
}
}
// Token: 0x0600014B RID: 331 RVA: 0x000083E0 File Offset: 0x000065E0
private void EmitLiftedToNullBinary(EmitContext ec)
{
ILGenerator ig = ec.ig;
LocalBuilder localBuilder = ec.EmitStored(this.left);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
ec.EmitNullableHasValue(localBuilder);
ec.EmitNullableHasValue(localBuilder2);
ig.Emit(OpCodes.And);
ig.Emit(OpCodes.Brtrue, label);
ec.EmitNullableInitialize(localBuilder3);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitNullableGetValueOrDefault(localBuilder2);
this.EmitBinaryOperator(ec);
ec.EmitNullableNew(localBuilder3.LocalType);
ig.MarkLabel(label2);
}
// Token: 0x0600014C RID: 332 RVA: 0x00008498 File Offset: 0x00006698
private void EmitLiftedRelationalBinary(EmitContext ec)
{
ILGenerator ig = ec.ig;
LocalBuilder localBuilder = ec.EmitStored(this.left);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ExpressionType expressionType = base.NodeType;
if (expressionType != ExpressionType.Equal && expressionType != ExpressionType.NotEqual)
{
this.EmitBinaryOperator(ec);
ig.Emit(OpCodes.Brfalse, label);
}
else
{
ig.Emit(OpCodes.Bne_Un, label);
}
ec.EmitNullableHasValue(localBuilder);
ec.EmitNullableHasValue(localBuilder2);
expressionType = base.NodeType;
if (expressionType != ExpressionType.Equal)
{
if (expressionType != ExpressionType.NotEqual)
{
ig.Emit(OpCodes.And);
}
else
{
ig.Emit(OpCodes.Ceq);
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
}
}
else
{
ig.Emit(OpCodes.Ceq);
}
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
ig.Emit((base.NodeType != ExpressionType.NotEqual) ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
ig.MarkLabel(label2);
}
// Token: 0x0600014D RID: 333 RVA: 0x000085DC File Offset: 0x000067DC
private void EmitArithmeticBinary(EmitContext ec)
{
if (!this.IsLifted)
{
this.EmitNonLiftedBinary(ec);
}
else
{
this.EmitLiftedArithmeticBinary(ec);
}
}
// Token: 0x0600014E RID: 334 RVA: 0x000085FC File Offset: 0x000067FC
private void EmitNonLiftedBinary(EmitContext ec)
{
ec.Emit(this.left);
ec.Emit(this.right);
this.EmitBinaryOperator(ec);
}
// Token: 0x0600014F RID: 335 RVA: 0x00008620 File Offset: 0x00006820
private void EmitRelationalBinary(EmitContext ec)
{
if (!this.IsLifted)
{
this.EmitNonLiftedBinary(ec);
}
else if (this.IsLiftedToNull)
{
this.EmitLiftedToNullBinary(ec);
}
else
{
this.EmitLiftedRelationalBinary(ec);
}
}
// Token: 0x06000150 RID: 336 RVA: 0x00008664 File Offset: 0x00006864
private void EmitLiftedUserDefinedOperator(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
Label label3 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
ec.EmitNullableHasValue(localBuilder);
ec.EmitNullableHasValue(localBuilder2);
ExpressionType nodeType = base.NodeType;
if (nodeType != ExpressionType.Equal)
{
if (nodeType != ExpressionType.NotEqual)
{
ig.Emit(OpCodes.And);
ig.Emit(OpCodes.Brfalse, label2);
}
else
{
ig.Emit(OpCodes.Bne_Un, label);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label2);
}
}
else
{
ig.Emit(OpCodes.Bne_Un, label2);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label);
}
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ec.EmitCall(this.method);
ig.Emit(OpCodes.Br, label3);
ig.MarkLabel(label);
ig.Emit(OpCodes.Ldc_I4_1);
ig.Emit(OpCodes.Br, label3);
ig.MarkLabel(label2);
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Br, label3);
ig.MarkLabel(label3);
}
// Token: 0x06000151 RID: 337 RVA: 0x000087AC File Offset: 0x000069AC
private void EmitLiftedToNullUserDefinedOperator(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
ec.EmitNullableHasValue(localBuilder);
ec.EmitNullableHasValue(localBuilder2);
ig.Emit(OpCodes.And);
ig.Emit(OpCodes.Brfalse, label);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ec.EmitCall(this.method);
ec.EmitNullableNew(base.Type);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
ec.EmitNullableInitialize(localBuilder3);
ig.MarkLabel(label2);
}
// Token: 0x06000152 RID: 338 RVA: 0x00008868 File Offset: 0x00006A68
private void EmitUserDefinedLiftedLogicalShortCircuit(EmitContext ec)
{
ILGenerator ig = ec.ig;
bool flag = base.NodeType == ExpressionType.AndAlso;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
Label label3 = ig.DefineLabel();
Label label4 = ig.DefineLabel();
LocalBuilder localBuilder = ec.EmitStored(this.left);
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, (!flag) ? label : label3);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitCall((!flag) ? this.GetTrueOperator() : this.GetFalseOperator());
ig.Emit(OpCodes.Brtrue, label2);
ig.MarkLabel(label);
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
ec.EmitNullableHasValue(localBuilder2);
ig.Emit(OpCodes.Brfalse, label3);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitNullableGetValueOrDefault(localBuilder2);
ec.EmitCall(this.method);
ec.EmitNullableNew(base.Type);
ig.Emit(OpCodes.Br, label4);
ig.MarkLabel(label2);
ec.EmitLoad(localBuilder);
ig.Emit(OpCodes.Br, label4);
ig.MarkLabel(label3);
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
ec.EmitNullableInitialize(localBuilder3);
ig.MarkLabel(label4);
}
// Token: 0x06000153 RID: 339 RVA: 0x000089A8 File Offset: 0x00006BA8
private void EmitUserDefinedOperator(EmitContext ec)
{
if (!this.IsLifted)
{
ExpressionType expressionType = base.NodeType;
if (expressionType != ExpressionType.AndAlso && expressionType != ExpressionType.OrElse)
{
this.left.Emit(ec);
this.right.Emit(ec);
ec.EmitCall(this.method);
}
else
{
this.EmitUserDefinedLogicalShortCircuit(ec);
}
}
else if (this.IsLiftedToNull)
{
ExpressionType expressionType = base.NodeType;
if (expressionType != ExpressionType.AndAlso && expressionType != ExpressionType.OrElse)
{
this.EmitLiftedToNullUserDefinedOperator(ec);
}
else
{
this.EmitUserDefinedLiftedLogicalShortCircuit(ec);
}
}
else
{
this.EmitLiftedUserDefinedOperator(ec);
}
}
// Token: 0x06000154 RID: 340 RVA: 0x00008A60 File Offset: 0x00006C60
internal override void Emit(EmitContext ec)
{
if (this.method != null)
{
this.EmitUserDefinedOperator(ec);
return;
}
switch (base.NodeType)
{
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.Divide:
case ExpressionType.ExclusiveOr:
case ExpressionType.LeftShift:
case ExpressionType.Modulo:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
case ExpressionType.Power:
case ExpressionType.RightShift:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
this.EmitArithmeticBinary(ec);
return;
case ExpressionType.And:
case ExpressionType.AndAlso:
case ExpressionType.Or:
case ExpressionType.OrElse:
this.EmitLogicalBinary(ec);
return;
case ExpressionType.ArrayIndex:
this.EmitArrayAccess(ec);
return;
case ExpressionType.Coalesce:
if (this.conversion != null)
{
this.EmitConvertedCoalesce(ec);
}
else
{
this.EmitCoalesce(ec);
}
return;
case ExpressionType.Equal:
case ExpressionType.GreaterThan:
case ExpressionType.GreaterThanOrEqual:
case ExpressionType.LessThan:
case ExpressionType.LessThanOrEqual:
case ExpressionType.NotEqual:
this.EmitRelationalBinary(ec);
return;
}
throw new NotSupportedException(base.NodeType.ToString());
}
// Token: 0x04000058 RID: 88
private Expression left;
// Token: 0x04000059 RID: 89
private Expression right;
// Token: 0x0400005A RID: 90
private LambdaExpression conversion;
// Token: 0x0400005B RID: 91
private MethodInfo method;
// Token: 0x0400005C RID: 92
private bool lift_to_null;
// Token: 0x0400005D RID: 93
private bool is_lifted;
}
}
@@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace System.Linq.Expressions
{
// Token: 0x02000019 RID: 25
internal class CompilationContext
{
// Token: 0x06000167 RID: 359 RVA: 0x000091AC File Offset: 0x000073AC
public int AddGlobal(object global)
{
return CompilationContext.AddItemToList<object>(global, this.globals);
}
// Token: 0x06000168 RID: 360 RVA: 0x000091BC File Offset: 0x000073BC
public object[] GetGlobals()
{
return this.globals.ToArray();
}
// Token: 0x06000169 RID: 361 RVA: 0x000091CC File Offset: 0x000073CC
private static int AddItemToList<T>(T item, IList<T> list)
{
list.Add(item);
return list.Count - 1;
}
// Token: 0x0600016A RID: 362 RVA: 0x000091E0 File Offset: 0x000073E0
public int AddCompilationUnit(LambdaExpression lambda)
{
this.DetectHoistedVariables(lambda);
return this.AddCompilationUnit(null, lambda);
}
// Token: 0x0600016B RID: 363 RVA: 0x000091F4 File Offset: 0x000073F4
public int AddCompilationUnit(EmitContext parent, LambdaExpression lambda)
{
EmitContext emitContext = new EmitContext(this, parent, lambda);
int num = CompilationContext.AddItemToList<EmitContext>(emitContext, this.units);
emitContext.Emit();
return num;
}
// Token: 0x0600016C RID: 364 RVA: 0x00009220 File Offset: 0x00007420
private void DetectHoistedVariables(LambdaExpression lambda)
{
this.hoisted_map = new CompilationContext.HoistedVariableDetector().Process(lambda);
}
// Token: 0x0600016D RID: 365 RVA: 0x00009234 File Offset: 0x00007434
public List<ParameterExpression> GetHoistedLocals(LambdaExpression lambda)
{
if (this.hoisted_map == null)
{
return null;
}
List<ParameterExpression> list;
this.hoisted_map.TryGetValue(lambda, out list);
return list;
}
// Token: 0x0600016E RID: 366 RVA: 0x00009260 File Offset: 0x00007460
public object[] CreateHoistedLocals(int unit)
{
List<ParameterExpression> hoistedLocals = this.GetHoistedLocals(this.units[unit].Lambda);
return new object[(hoistedLocals != null) ? hoistedLocals.Count : 0];
}
// Token: 0x0600016F RID: 367 RVA: 0x0000929C File Offset: 0x0000749C
public Expression IsolateExpression(ExecutionScope scope, object[] locals, Expression expression)
{
return new CompilationContext.ParameterReplacer(this, scope, locals).Transform(expression);
}
// Token: 0x06000170 RID: 368 RVA: 0x000092AC File Offset: 0x000074AC
public Delegate CreateDelegate()
{
return this.CreateDelegate(0, new ExecutionScope(this));
}
// Token: 0x06000171 RID: 369 RVA: 0x000092BC File Offset: 0x000074BC
public Delegate CreateDelegate(int unit, ExecutionScope scope)
{
return this.units[unit].CreateDelegate(scope);
}
// Token: 0x04000064 RID: 100
private List<object> globals = new List<object>();
// Token: 0x04000065 RID: 101
private List<EmitContext> units = new List<EmitContext>();
// Token: 0x04000066 RID: 102
private Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map;
// Token: 0x0200001A RID: 26
private class ParameterReplacer : ExpressionTransformer
{
// Token: 0x06000172 RID: 370 RVA: 0x000092D0 File Offset: 0x000074D0
public ParameterReplacer(CompilationContext context, ExecutionScope scope, object[] locals)
{
this.context = context;
this.scope = scope;
this.locals = locals;
}
// Token: 0x06000173 RID: 371 RVA: 0x000092F0 File Offset: 0x000074F0
protected override Expression VisitParameter(ParameterExpression parameter)
{
ExecutionScope parent = this.scope;
object[] array = this.locals;
while (parent != null)
{
int num = this.IndexOfHoistedLocal(parent, parameter);
if (num != -1)
{
return this.ReadHoistedLocalFromArray(array, num);
}
array = parent.Locals;
parent = parent.Parent;
}
return parameter;
}
// Token: 0x06000174 RID: 372 RVA: 0x00009340 File Offset: 0x00007540
private Expression ReadHoistedLocalFromArray(object[] locals, int position)
{
return Expression.Field(Expression.Convert(Expression.ArrayIndex(Expression.Constant(locals), Expression.Constant(position)), locals[position].GetType()), "Value");
}
// Token: 0x06000175 RID: 373 RVA: 0x0000937C File Offset: 0x0000757C
private int IndexOfHoistedLocal(ExecutionScope scope, ParameterExpression parameter)
{
return this.context.units[scope.compilation_unit].IndexOfHoistedLocal(parameter);
}
// Token: 0x04000067 RID: 103
private CompilationContext context;
// Token: 0x04000068 RID: 104
private ExecutionScope scope;
// Token: 0x04000069 RID: 105
private object[] locals;
}
// Token: 0x0200001B RID: 27
private class HoistedVariableDetector : ExpressionVisitor
{
// Token: 0x06000177 RID: 375 RVA: 0x000093B0 File Offset: 0x000075B0
public Dictionary<LambdaExpression, List<ParameterExpression>> Process(LambdaExpression lambda)
{
this.Visit(lambda);
return this.hoisted_map;
}
// Token: 0x06000178 RID: 376 RVA: 0x000093C0 File Offset: 0x000075C0
protected override void VisitLambda(LambdaExpression lambda)
{
this.lambda = lambda;
foreach (ParameterExpression parameterExpression in lambda.Parameters)
{
this.parameter_to_lambda[parameterExpression] = lambda;
}
base.VisitLambda(lambda);
}
// Token: 0x06000179 RID: 377 RVA: 0x00009438 File Offset: 0x00007638
protected override void VisitParameter(ParameterExpression parameter)
{
if (this.lambda.Parameters.Contains(parameter))
{
return;
}
this.Hoist(parameter);
}
// Token: 0x0600017A RID: 378 RVA: 0x00009458 File Offset: 0x00007658
private void Hoist(ParameterExpression parameter)
{
LambdaExpression lambdaExpression;
if (!this.parameter_to_lambda.TryGetValue(parameter, out lambdaExpression))
{
return;
}
if (this.hoisted_map == null)
{
this.hoisted_map = new Dictionary<LambdaExpression, List<ParameterExpression>>();
}
List<ParameterExpression> list;
if (!this.hoisted_map.TryGetValue(lambdaExpression, out list))
{
list = new List<ParameterExpression>();
this.hoisted_map[lambdaExpression] = list;
}
list.Add(parameter);
}
// Token: 0x0400006A RID: 106
private Dictionary<ParameterExpression, LambdaExpression> parameter_to_lambda = new Dictionary<ParameterExpression, LambdaExpression>();
// Token: 0x0400006B RID: 107
private Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map;
// Token: 0x0400006C RID: 108
private LambdaExpression lambda;
}
}
}
@@ -0,0 +1,79 @@
using System;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an expression that has a conditional operator.</summary>
// Token: 0x02000016 RID: 22
public sealed class ConditionalExpression : Expression
{
// Token: 0x06000155 RID: 341 RVA: 0x00008B98 File Offset: 0x00006D98
internal ConditionalExpression(Expression test, Expression if_true, Expression if_false)
: base(ExpressionType.Conditional, if_true.Type)
{
this.test = test;
this.if_true = if_true;
this.if_false = if_false;
}
/// <summary>Gets the test of the conditional operation.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the test of the conditional operation.</returns>
// Token: 0x17000017 RID: 23
// (get) Token: 0x06000156 RID: 342 RVA: 0x00008BC8 File Offset: 0x00006DC8
public Expression Test
{
get
{
return this.test;
}
}
/// <summary>Gets the expression to execute if the test evaluates to true.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is true.</returns>
// Token: 0x17000018 RID: 24
// (get) Token: 0x06000157 RID: 343 RVA: 0x00008BD0 File Offset: 0x00006DD0
public Expression IfTrue
{
get
{
return this.if_true;
}
}
/// <summary>Gets the expression to execute if the test evaluates to false.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is false.</returns>
// Token: 0x17000019 RID: 25
// (get) Token: 0x06000158 RID: 344 RVA: 0x00008BD8 File Offset: 0x00006DD8
public Expression IfFalse
{
get
{
return this.if_false;
}
}
// Token: 0x06000159 RID: 345 RVA: 0x00008BE0 File Offset: 0x00006DE0
internal override void Emit(EmitContext ec)
{
ILGenerator ig = ec.ig;
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
this.test.Emit(ec);
ig.Emit(OpCodes.Brfalse, label);
this.if_true.Emit(ec);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
this.if_false.Emit(ec);
ig.MarkLabel(label2);
}
// Token: 0x0400005E RID: 94
private Expression test;
// Token: 0x0400005F RID: 95
private Expression if_true;
// Token: 0x04000060 RID: 96
private Expression if_false;
}
}
@@ -0,0 +1,183 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an expression that has a constant value.</summary>
// Token: 0x02000017 RID: 23
public sealed class ConstantExpression : Expression
{
// Token: 0x0600015A RID: 346 RVA: 0x00008C4C File Offset: 0x00006E4C
internal ConstantExpression(object value, Type type)
: base(ExpressionType.Constant, type)
{
this.value = value;
}
/// <summary>Gets the value of the constant expression.</summary>
/// <returns>An <see cref="T:System.Object" /> equal to the value of the represented expression.</returns>
// Token: 0x1700001A RID: 26
// (get) Token: 0x0600015B RID: 347 RVA: 0x00008C60 File Offset: 0x00006E60
public object Value
{
get
{
return this.value;
}
}
// Token: 0x0600015C RID: 348 RVA: 0x00008C68 File Offset: 0x00006E68
internal override void Emit(EmitContext ec)
{
if (base.Type.IsNullable())
{
this.EmitNullableConstant(ec, base.Type, this.value);
return;
}
this.EmitConstant(ec, base.Type, this.value);
}
// Token: 0x0600015D RID: 349 RVA: 0x00008CAC File Offset: 0x00006EAC
private void EmitNullableConstant(EmitContext ec, Type type, object value)
{
if (value == null)
{
ILGenerator ig = ec.ig;
LocalBuilder localBuilder = ig.DeclareLocal(type);
ig.Emit(OpCodes.Ldloca, localBuilder);
ig.Emit(OpCodes.Initobj, type);
ig.Emit(OpCodes.Ldloc, localBuilder);
}
else
{
this.EmitConstant(ec, type.GetFirstGenericArgument(), value);
ec.EmitNullableNew(type);
}
}
// Token: 0x0600015E RID: 350 RVA: 0x00008D0C File Offset: 0x00006F0C
private void EmitConstant(EmitContext ec, Type type, object value)
{
ILGenerator ig = ec.ig;
switch (Type.GetTypeCode(type))
{
case TypeCode.Object:
this.EmitIfNotNull(ec, delegate(EmitContext c)
{
c.EmitReadGlobal(value);
});
return;
case TypeCode.DBNull:
ig.Emit(OpCodes.Ldsfld, typeof(DBNull).GetField("Value", BindingFlags.Static | BindingFlags.Public));
return;
case TypeCode.Boolean:
if ((bool)this.Value)
{
ig.Emit(OpCodes.Ldc_I4_1);
}
else
{
ec.ig.Emit(OpCodes.Ldc_I4_0);
}
return;
case TypeCode.Char:
ig.Emit(OpCodes.Ldc_I4, (int)((char)value));
return;
case TypeCode.SByte:
ig.Emit(OpCodes.Ldc_I4, (int)((sbyte)value));
return;
case TypeCode.Byte:
ig.Emit(OpCodes.Ldc_I4, (int)((byte)value));
return;
case TypeCode.Int16:
ig.Emit(OpCodes.Ldc_I4, (int)((short)value));
return;
case TypeCode.UInt16:
ig.Emit(OpCodes.Ldc_I4, (int)((ushort)value));
return;
case TypeCode.Int32:
ig.Emit(OpCodes.Ldc_I4, (int)value);
return;
case TypeCode.UInt32:
ig.Emit(OpCodes.Ldc_I4, (int)((uint)this.Value));
return;
case TypeCode.Int64:
ig.Emit(OpCodes.Ldc_I8, (long)value);
return;
case TypeCode.UInt64:
ig.Emit(OpCodes.Ldc_I8, (long)((ulong)value));
return;
case TypeCode.Single:
ig.Emit(OpCodes.Ldc_R4, (float)value);
return;
case TypeCode.Double:
ig.Emit(OpCodes.Ldc_R8, (double)value);
return;
case TypeCode.Decimal:
{
decimal num = (decimal)value;
int[] bits = decimal.GetBits(num);
int num2 = (bits[3] >> 16) & 255;
Type typeFromHandle = typeof(int);
if (num2 == 0 && num <= 2147483647m && num >= -2147483648m)
{
ig.Emit(OpCodes.Ldc_I4, (int)num);
ig.Emit(OpCodes.Newobj, typeof(decimal).GetConstructor(new Type[] { typeFromHandle }));
return;
}
ig.Emit(OpCodes.Ldc_I4, bits[0]);
ig.Emit(OpCodes.Ldc_I4, bits[1]);
ig.Emit(OpCodes.Ldc_I4, bits[2]);
ig.Emit(OpCodes.Ldc_I4, bits[3] >> 31);
ig.Emit(OpCodes.Ldc_I4, num2);
ig.Emit(OpCodes.Newobj, typeof(decimal).GetConstructor(new Type[]
{
typeFromHandle,
typeFromHandle,
typeFromHandle,
typeof(bool),
typeof(byte)
}));
return;
}
case TypeCode.DateTime:
{
DateTime dateTime = (DateTime)value;
LocalBuilder localBuilder = ig.DeclareLocal(typeof(DateTime));
ig.Emit(OpCodes.Ldloca, localBuilder);
ig.Emit(OpCodes.Ldc_I8, dateTime.Ticks);
ig.Emit(OpCodes.Ldc_I4, (int)dateTime.Kind);
ig.Emit(OpCodes.Call, typeof(DateTime).GetConstructor(new Type[]
{
typeof(long),
typeof(DateTimeKind)
}));
ig.Emit(OpCodes.Ldloc, localBuilder);
return;
}
case TypeCode.String:
this.EmitIfNotNull(ec, delegate(EmitContext c)
{
c.ig.Emit(OpCodes.Ldstr, (string)value);
});
return;
}
throw new NotImplementedException(string.Format("No support for constants of type {0} yet", base.Type));
}
// Token: 0x0600015F RID: 351 RVA: 0x000090E8 File Offset: 0x000072E8
private void EmitIfNotNull(EmitContext ec, Action<EmitContext> emit)
{
if (this.value == null)
{
ec.ig.Emit(OpCodes.Ldnull);
return;
}
emit(ec);
}
// Token: 0x04000061 RID: 97
private object value;
}
}
@@ -0,0 +1,74 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an initializer for a single element of an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
// Token: 0x02000018 RID: 24
public sealed class ElementInit
{
// Token: 0x06000160 RID: 352 RVA: 0x00009110 File Offset: 0x00007310
internal ElementInit(MethodInfo add_method, ReadOnlyCollection<Expression> arguments)
{
this.add_method = add_method;
this.arguments = arguments;
}
/// <summary>Gets the instance method that is used to add an element to an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
/// <returns>A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method that adds an element to a collection.</returns>
// Token: 0x1700001B RID: 27
// (get) Token: 0x06000161 RID: 353 RVA: 0x00009128 File Offset: 0x00007328
public MethodInfo AddMethod
{
get
{
return this.add_method;
}
}
/// <summary>Gets the collection of arguments that are passed to a method that adds an element to an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments for a method that adds an element to a collection.</returns>
// Token: 0x1700001C RID: 28
// (get) Token: 0x06000162 RID: 354 RVA: 0x00009130 File Offset: 0x00007330
public ReadOnlyCollection<Expression> Arguments
{
get
{
return this.arguments;
}
}
/// <summary>Returns a textual representation of an <see cref="T:System.Linq.Expressions.ElementInit" /> object.</summary>
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.ElementInit" /> object.</returns>
// Token: 0x06000163 RID: 355 RVA: 0x00009138 File Offset: 0x00007338
public override string ToString()
{
return ExpressionPrinter.ToString(this);
}
// Token: 0x06000164 RID: 356 RVA: 0x00009140 File Offset: 0x00007340
private void EmitPopIfNeeded(EmitContext ec)
{
if (this.add_method.ReturnType == typeof(void))
{
return;
}
ec.ig.Emit(OpCodes.Pop);
}
// Token: 0x06000165 RID: 357 RVA: 0x00009170 File Offset: 0x00007370
internal void Emit(EmitContext ec, LocalBuilder local)
{
ec.EmitCall(local, this.arguments, this.add_method);
this.EmitPopIfNeeded(ec);
}
// Token: 0x04000062 RID: 98
private MethodInfo add_method;
// Token: 0x04000063 RID: 99
private ReadOnlyCollection<Expression> arguments;
}
}
@@ -0,0 +1,456 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
namespace System.Linq.Expressions
{
// Token: 0x0200001C RID: 28
internal class EmitContext
{
// Token: 0x0600017B RID: 379 RVA: 0x000094BC File Offset: 0x000076BC
public EmitContext(CompilationContext context, EmitContext parent, LambdaExpression lambda)
{
this.context = context;
this.parent = parent;
this.lambda = lambda;
this.hoisted = context.GetHoistedLocals(lambda);
this.method = new DynamicMethod("lambda_method", lambda.GetReturnType(), EmitContext.CreateParameterTypes(lambda.Parameters), typeof(ExecutionScope), true);
this.ig = this.method.GetILGenerator();
}
// Token: 0x1700001D RID: 29
// (get) Token: 0x0600017C RID: 380 RVA: 0x00009530 File Offset: 0x00007730
public bool HasHoistedLocals
{
get
{
return this.hoisted != null && this.hoisted.Count > 0;
}
}
// Token: 0x1700001E RID: 30
// (get) Token: 0x0600017D RID: 381 RVA: 0x00009550 File Offset: 0x00007750
public LambdaExpression Lambda
{
get
{
return this.lambda;
}
}
// Token: 0x0600017E RID: 382 RVA: 0x00009558 File Offset: 0x00007758
public void Emit()
{
if (this.HasHoistedLocals)
{
this.EmitStoreHoistedLocals();
}
this.lambda.EmitBody(this);
}
// Token: 0x0600017F RID: 383 RVA: 0x00009578 File Offset: 0x00007778
private static Type[] CreateParameterTypes(IList<ParameterExpression> parameters)
{
Type[] array = new Type[parameters.Count + 1];
array[0] = typeof(ExecutionScope);
for (int i = 0; i < parameters.Count; i++)
{
array[i + 1] = parameters[i].Type;
}
return array;
}
// Token: 0x06000180 RID: 384 RVA: 0x000095CC File Offset: 0x000077CC
public bool IsLocalParameter(ParameterExpression parameter, ref int position)
{
position = this.lambda.Parameters.IndexOf(parameter);
if (position > -1)
{
position++;
return true;
}
return false;
}
// Token: 0x06000181 RID: 385 RVA: 0x00009600 File Offset: 0x00007800
public Delegate CreateDelegate(ExecutionScope scope)
{
return this.method.CreateDelegate(this.lambda.Type, scope);
}
// Token: 0x06000182 RID: 386 RVA: 0x0000961C File Offset: 0x0000781C
public void Emit(Expression expression)
{
expression.Emit(this);
}
// Token: 0x06000183 RID: 387 RVA: 0x00009628 File Offset: 0x00007828
public LocalBuilder EmitStored(Expression expression)
{
LocalBuilder localBuilder = this.ig.DeclareLocal(expression.Type);
expression.Emit(this);
this.ig.Emit(OpCodes.Stloc, localBuilder);
return localBuilder;
}
// Token: 0x06000184 RID: 388 RVA: 0x00009660 File Offset: 0x00007860
public void EmitLoadAddress(Expression expression)
{
this.ig.Emit(OpCodes.Ldloca, this.EmitStored(expression));
}
// Token: 0x06000185 RID: 389 RVA: 0x0000967C File Offset: 0x0000787C
public void EmitLoadSubject(Expression expression)
{
if (expression.Type.IsValueType)
{
this.EmitLoadAddress(expression);
return;
}
this.Emit(expression);
}
// Token: 0x06000186 RID: 390 RVA: 0x000096A8 File Offset: 0x000078A8
public void EmitLoadSubject(LocalBuilder local)
{
if (local.LocalType.IsValueType)
{
this.EmitLoadAddress(local);
return;
}
this.EmitLoad(local);
}
// Token: 0x06000187 RID: 391 RVA: 0x000096D4 File Offset: 0x000078D4
public void EmitLoadAddress(LocalBuilder local)
{
this.ig.Emit(OpCodes.Ldloca, local);
}
// Token: 0x06000188 RID: 392 RVA: 0x000096E8 File Offset: 0x000078E8
public void EmitLoad(LocalBuilder local)
{
this.ig.Emit(OpCodes.Ldloc, local);
}
// Token: 0x06000189 RID: 393 RVA: 0x000096FC File Offset: 0x000078FC
public void EmitCall(LocalBuilder local, IList<Expression> arguments, MethodInfo method)
{
this.EmitLoadSubject(local);
this.EmitArguments(method, arguments);
this.EmitCall(method);
}
// Token: 0x0600018A RID: 394 RVA: 0x00009714 File Offset: 0x00007914
public void EmitCall(LocalBuilder local, MethodInfo method)
{
this.EmitLoadSubject(local);
this.EmitCall(method);
}
// Token: 0x0600018B RID: 395 RVA: 0x00009724 File Offset: 0x00007924
public void EmitCall(Expression expression, MethodInfo method)
{
if (!method.IsStatic)
{
this.EmitLoadSubject(expression);
}
this.EmitCall(method);
}
// Token: 0x0600018C RID: 396 RVA: 0x00009740 File Offset: 0x00007940
public void EmitCall(Expression expression, IList<Expression> arguments, MethodInfo method)
{
if (!method.IsStatic)
{
this.EmitLoadSubject(expression);
}
this.EmitArguments(method, arguments);
this.EmitCall(method);
}
// Token: 0x0600018D RID: 397 RVA: 0x00009770 File Offset: 0x00007970
private void EmitArguments(MethodInfo method, IList<Expression> arguments)
{
ParameterInfo[] parameters = method.GetParameters();
for (int i = 0; i < parameters.Length; i++)
{
ParameterInfo parameterInfo = parameters[i];
Expression expression = arguments[i];
if (parameterInfo.ParameterType.IsByRef)
{
this.ig.Emit(OpCodes.Ldloca, this.EmitStored(expression));
}
else
{
this.Emit(arguments[i]);
}
}
}
// Token: 0x0600018E RID: 398 RVA: 0x000097E0 File Offset: 0x000079E0
public void EmitCall(MethodInfo method)
{
this.ig.Emit((!method.IsVirtual) ? OpCodes.Call : OpCodes.Callvirt, method);
}
// Token: 0x0600018F RID: 399 RVA: 0x00009814 File Offset: 0x00007A14
public void EmitNullableHasValue(LocalBuilder local)
{
this.EmitCall(local, "get_HasValue");
}
// Token: 0x06000190 RID: 400 RVA: 0x00009824 File Offset: 0x00007A24
public void EmitNullableInitialize(LocalBuilder local)
{
this.ig.Emit(OpCodes.Ldloca, local);
this.ig.Emit(OpCodes.Initobj, local.LocalType);
this.ig.Emit(OpCodes.Ldloc, local);
}
// Token: 0x06000191 RID: 401 RVA: 0x0000986C File Offset: 0x00007A6C
public void EmitNullableGetValue(LocalBuilder local)
{
this.EmitCall(local, "get_Value");
}
// Token: 0x06000192 RID: 402 RVA: 0x0000987C File Offset: 0x00007A7C
public void EmitNullableGetValueOrDefault(LocalBuilder local)
{
this.EmitCall(local, "GetValueOrDefault");
}
// Token: 0x06000193 RID: 403 RVA: 0x0000988C File Offset: 0x00007A8C
private void EmitCall(LocalBuilder local, string method_name)
{
this.EmitCall(local, local.LocalType.GetMethod(method_name, Type.EmptyTypes));
}
// Token: 0x06000194 RID: 404 RVA: 0x000098A8 File Offset: 0x00007AA8
public void EmitNullableNew(Type of)
{
this.ig.Emit(OpCodes.Newobj, of.GetConstructor(new Type[] { of.GetFirstGenericArgument() }));
}
// Token: 0x06000195 RID: 405 RVA: 0x000098D0 File Offset: 0x00007AD0
public void EmitCollection<T>(IEnumerable<T> collection) where T : Expression
{
foreach (T t in collection)
{
t.Emit(this);
}
}
// Token: 0x06000196 RID: 406 RVA: 0x00009938 File Offset: 0x00007B38
public void EmitCollection(IEnumerable<ElementInit> initializers, LocalBuilder local)
{
foreach (ElementInit elementInit in initializers)
{
elementInit.Emit(this, local);
}
}
// Token: 0x06000197 RID: 407 RVA: 0x00009998 File Offset: 0x00007B98
public void EmitCollection(IEnumerable<MemberBinding> bindings, LocalBuilder local)
{
foreach (MemberBinding memberBinding in bindings)
{
memberBinding.Emit(this, local);
}
}
// Token: 0x06000198 RID: 408 RVA: 0x000099F8 File Offset: 0x00007BF8
public void EmitIsInst(Expression expression, Type candidate)
{
expression.Emit(this);
Type type = expression.Type;
if (type.IsValueType)
{
this.ig.Emit(OpCodes.Box, type);
}
this.ig.Emit(OpCodes.Isinst, candidate);
}
// Token: 0x06000199 RID: 409 RVA: 0x00009A40 File Offset: 0x00007C40
public void EmitScope()
{
this.ig.Emit(OpCodes.Ldarg_0);
}
// Token: 0x0600019A RID: 410 RVA: 0x00009A54 File Offset: 0x00007C54
public void EmitReadGlobal(object global)
{
this.EmitReadGlobal(global, global.GetType());
}
// Token: 0x0600019B RID: 411 RVA: 0x00009A64 File Offset: 0x00007C64
public void EmitLoadGlobals()
{
this.EmitScope();
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Globals"));
}
// Token: 0x0600019C RID: 412 RVA: 0x00009A9C File Offset: 0x00007C9C
public void EmitReadGlobal(object global, Type type)
{
this.EmitLoadGlobals();
this.ig.Emit(OpCodes.Ldc_I4, this.AddGlobal(global, type));
this.ig.Emit(OpCodes.Ldelem, typeof(object));
this.EmitLoadStrongBoxValue(type);
}
// Token: 0x0600019D RID: 413 RVA: 0x00009AE8 File Offset: 0x00007CE8
public void EmitLoadStrongBoxValue(Type type)
{
Type type2 = type.MakeStrongBoxType();
this.ig.Emit(OpCodes.Isinst, type2);
this.ig.Emit(OpCodes.Ldfld, type2.GetField("Value"));
}
// Token: 0x0600019E RID: 414 RVA: 0x00009B28 File Offset: 0x00007D28
private int AddGlobal(object value, Type type)
{
return this.context.AddGlobal(EmitContext.CreateStrongBox(value, type));
}
// Token: 0x0600019F RID: 415 RVA: 0x00009B3C File Offset: 0x00007D3C
public void EmitCreateDelegate(LambdaExpression lambda)
{
this.EmitScope();
this.ig.Emit(OpCodes.Ldc_I4, this.AddChildContext(lambda));
if (this.hoisted_store != null)
{
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
}
else
{
this.ig.Emit(OpCodes.Ldnull);
}
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("CreateDelegate"));
this.ig.Emit(OpCodes.Castclass, lambda.Type);
}
// Token: 0x060001A0 RID: 416 RVA: 0x00009BD8 File Offset: 0x00007DD8
private void EmitStoreHoistedLocals()
{
this.EmitHoistedLocalsStore();
for (int i = 0; i < this.hoisted.Count; i++)
{
this.EmitStoreHoistedLocal(i, this.hoisted[i]);
}
}
// Token: 0x060001A1 RID: 417 RVA: 0x00009C1C File Offset: 0x00007E1C
private void EmitStoreHoistedLocal(int position, ParameterExpression parameter)
{
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
this.ig.Emit(OpCodes.Ldc_I4, position);
parameter.Emit(this);
this.EmitCreateStrongBox(parameter.Type);
this.ig.Emit(OpCodes.Stelem, typeof(object));
}
// Token: 0x060001A2 RID: 418 RVA: 0x00009C80 File Offset: 0x00007E80
public void EmitLoadHoistedLocalsStore()
{
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
}
// Token: 0x060001A3 RID: 419 RVA: 0x00009C98 File Offset: 0x00007E98
private void EmitCreateStrongBox(Type type)
{
this.ig.Emit(OpCodes.Newobj, type.MakeStrongBoxType().GetConstructor(new Type[] { type }));
}
// Token: 0x060001A4 RID: 420 RVA: 0x00009CC0 File Offset: 0x00007EC0
private void EmitHoistedLocalsStore()
{
this.EmitScope();
this.hoisted_store = this.ig.DeclareLocal(typeof(object[]));
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("CreateHoistedLocals"));
this.ig.Emit(OpCodes.Stloc, this.hoisted_store);
}
// Token: 0x060001A5 RID: 421 RVA: 0x00009D28 File Offset: 0x00007F28
public void EmitLoadLocals()
{
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Locals"));
}
// Token: 0x060001A6 RID: 422 RVA: 0x00009D5C File Offset: 0x00007F5C
public void EmitParentScope()
{
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Parent"));
}
// Token: 0x060001A7 RID: 423 RVA: 0x00009D90 File Offset: 0x00007F90
public void EmitIsolateExpression()
{
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("IsolateExpression"));
}
// Token: 0x060001A8 RID: 424 RVA: 0x00009DC4 File Offset: 0x00007FC4
public int IndexOfHoistedLocal(ParameterExpression parameter)
{
if (!this.HasHoistedLocals)
{
return -1;
}
return this.hoisted.IndexOf(parameter);
}
// Token: 0x060001A9 RID: 425 RVA: 0x00009DE0 File Offset: 0x00007FE0
public bool IsHoistedLocal(ParameterExpression parameter, ref int level, ref int position)
{
if (this.parent == null)
{
return false;
}
if (this.parent.hoisted != null)
{
position = this.parent.hoisted.IndexOf(parameter);
if (position > -1)
{
return true;
}
}
level++;
return this.parent.IsHoistedLocal(parameter, ref level, ref position);
}
// Token: 0x060001AA RID: 426 RVA: 0x00009E3C File Offset: 0x0000803C
private int AddChildContext(LambdaExpression lambda)
{
return this.context.AddCompilationUnit(this, lambda);
}
// Token: 0x060001AB RID: 427 RVA: 0x00009E4C File Offset: 0x0000804C
private static object CreateStrongBox(object value, Type type)
{
return Activator.CreateInstance(type.MakeStrongBoxType(), new object[] { value });
}
// Token: 0x0400006D RID: 109
private CompilationContext context;
// Token: 0x0400006E RID: 110
private EmitContext parent;
// Token: 0x0400006F RID: 111
private LambdaExpression lambda;
// Token: 0x04000070 RID: 112
private DynamicMethod method;
// Token: 0x04000071 RID: 113
private LocalBuilder hoisted_store;
// Token: 0x04000072 RID: 114
private List<ParameterExpression> hoisted;
// Token: 0x04000073 RID: 115
public readonly ILGenerator ig;
}
}
@@ -0,0 +1,3621 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Reflection;
namespace System.Linq.Expressions
{
/// <summary>Provides the base class from which the classes that represent expression tree nodes are derived. It also contains static (Shared in Visual Basic) factory methods to create the various node types. This is an abstract class.</summary>
// Token: 0x02000005 RID: 5
public abstract class Expression
{
/// <summary>Initializes a new instance of the <see cref="T:System.Linq.Expressions.Expression" /> class.</summary>
/// <param name="nodeType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> to set as the node type.</param>
/// <param name="type">The <see cref="T:System.Type" /> to set as the type of the expression that this <see cref="T:System.Linq.Expressions.Expression" /> represents.</param>
// Token: 0x0600000C RID: 12 RVA: 0x000021FC File Offset: 0x000003FC
protected Expression(ExpressionType node_type, Type type)
{
this.node_type = node_type;
this.type = type;
}
/// <summary>Gets the node type of this <see cref="T:System.Linq.Expressions.Expression" />.</summary>
/// <returns>One of the <see cref="T:System.Linq.Expressions.ExpressionType" /> values.</returns>
// Token: 0x17000003 RID: 3
// (get) Token: 0x0600000D RID: 13 RVA: 0x00002214 File Offset: 0x00000414
public ExpressionType NodeType
{
get
{
return this.node_type;
}
}
/// <summary>Gets the static type of the expression that this <see cref="T:System.Linq.Expressions.Expression" /> represents.</summary>
/// <returns>The <see cref="T:System.Type" /> that represents the static type of the expression.</returns>
// Token: 0x17000004 RID: 4
// (get) Token: 0x0600000E RID: 14 RVA: 0x0000221C File Offset: 0x0000041C
public Type Type
{
get
{
return this.type;
}
}
/// <summary>Returns a textual representation of the <see cref="T:System.Linq.Expressions.Expression" />.</summary>
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.Expression" />.</returns>
// Token: 0x0600000F RID: 15 RVA: 0x00002224 File Offset: 0x00000424
public override string ToString()
{
return ExpressionPrinter.ToString(this);
}
// Token: 0x06000010 RID: 16 RVA: 0x0000222C File Offset: 0x0000042C
private static MethodInfo GetUnaryOperator(string oper_name, Type declaring, Type param)
{
return Expression.GetUnaryOperator(oper_name, declaring, param, null);
}
// Token: 0x06000011 RID: 17 RVA: 0x00002238 File Offset: 0x00000438
private static MethodInfo GetUnaryOperator(string oper_name, Type declaring, Type param, Type ret)
{
MethodInfo[] methods = declaring.GetNotNullableType().GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
foreach (MethodInfo methodInfo in methods)
{
if (!(methodInfo.Name != oper_name))
{
ParameterInfo[] parameters = methodInfo.GetParameters();
if (parameters.Length == 1)
{
if (!methodInfo.IsGenericMethod)
{
if (Expression.IsAssignableToParameterType(param.GetNotNullableType(), parameters[0]))
{
if (ret == null || methodInfo.ReturnType == ret.GetNotNullableType())
{
return methodInfo;
}
}
}
}
}
}
return null;
}
// Token: 0x06000012 RID: 18 RVA: 0x000022E4 File Offset: 0x000004E4
internal static MethodInfo GetTrueOperator(Type self)
{
return Expression.GetBooleanOperator("op_True", self);
}
// Token: 0x06000013 RID: 19 RVA: 0x000022F4 File Offset: 0x000004F4
internal static MethodInfo GetFalseOperator(Type self)
{
return Expression.GetBooleanOperator("op_False", self);
}
// Token: 0x06000014 RID: 20 RVA: 0x00002304 File Offset: 0x00000504
private static MethodInfo GetBooleanOperator(string op, Type self)
{
return Expression.GetUnaryOperator(op, self, self, typeof(bool));
}
// Token: 0x06000015 RID: 21 RVA: 0x00002318 File Offset: 0x00000518
private static bool IsAssignableToParameterType(Type type, ParameterInfo param)
{
Type type2 = param.ParameterType;
if (type2.IsByRef)
{
type2 = type2.GetElementType();
}
return type.GetNotNullableType().IsAssignableTo(type2);
}
// Token: 0x06000016 RID: 22 RVA: 0x0000234C File Offset: 0x0000054C
private static MethodInfo CheckUnaryMethod(MethodInfo method, Type param)
{
if (method.ReturnType == typeof(void))
{
throw new ArgumentException("Specified method must return a value", "method");
}
if (!method.IsStatic)
{
throw new ArgumentException("Method must be static", "method");
}
ParameterInfo[] parameters = method.GetParameters();
if (parameters.Length != 1)
{
throw new ArgumentException("Must have only one parameters", "method");
}
if (!Expression.IsAssignableToParameterType(param.GetNotNullableType(), parameters[0]))
{
throw new InvalidOperationException("left-side argument type does not match expression type");
}
return method;
}
// Token: 0x06000017 RID: 23 RVA: 0x000023D8 File Offset: 0x000005D8
private static MethodInfo UnaryCoreCheck(string oper_name, Expression expression, MethodInfo method, Func<Type, bool> validator)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (method != null)
{
return Expression.CheckUnaryMethod(method, expression.Type);
}
Type notNullableType = expression.Type.GetNotNullableType();
if (validator(notNullableType))
{
return null;
}
if (oper_name != null)
{
method = Expression.GetUnaryOperator(oper_name, notNullableType, expression.Type);
if (method != null)
{
return method;
}
}
throw new InvalidOperationException(string.Format("Operation {0} not defined for {1}", (oper_name == null) ? "is" : oper_name.Substring(3), expression.Type));
}
// Token: 0x06000018 RID: 24 RVA: 0x0000246C File Offset: 0x0000066C
private static MethodInfo GetBinaryOperator(string oper_name, Type on_type, Expression left, Expression right)
{
MethodInfo[] methods = on_type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
foreach (MethodInfo methodInfo in methods)
{
if (!(methodInfo.Name != oper_name))
{
ParameterInfo[] parameters = methodInfo.GetParameters();
if (parameters.Length == 2)
{
if (!methodInfo.IsGenericMethod)
{
if (Expression.IsAssignableToParameterType(left.Type, parameters[0]))
{
if (Expression.IsAssignableToParameterType(right.Type, parameters[1]))
{
return methodInfo;
}
}
}
}
}
}
return null;
}
// Token: 0x06000019 RID: 25 RVA: 0x00002510 File Offset: 0x00000710
private static MethodInfo BinaryCoreCheck(string oper_name, Expression left, Expression right, MethodInfo method)
{
if (left == null)
{
throw new ArgumentNullException("left");
}
if (right == null)
{
throw new ArgumentNullException("right");
}
if (method != null)
{
if (method.ReturnType == typeof(void))
{
throw new ArgumentException("Specified method must return a value", "method");
}
if (!method.IsStatic)
{
throw new ArgumentException("Method must be static", "method");
}
ParameterInfo[] parameters = method.GetParameters();
if (parameters.Length != 2)
{
throw new ArgumentException("Must have only two parameters", "method");
}
if (!Expression.IsAssignableToParameterType(left.Type, parameters[0]))
{
throw new InvalidOperationException("left-side argument type does not match left expression type");
}
if (!Expression.IsAssignableToParameterType(right.Type, parameters[1]))
{
throw new InvalidOperationException("right-side argument type does not match right expression type");
}
return method;
}
else
{
Type type = left.Type;
Type type2 = right.Type;
Type notNullableType = type.GetNotNullableType();
Type notNullableType2 = type2.GetNotNullableType();
if ((oper_name == "op_BitwiseOr" || oper_name == "op_BitwiseAnd") && notNullableType == typeof(bool) && notNullableType == notNullableType2 && type == type2)
{
return null;
}
if (Expression.IsNumber(notNullableType))
{
if (notNullableType == notNullableType2 && type == type2)
{
return null;
}
if (oper_name != null)
{
method = Expression.GetBinaryOperator(oper_name, notNullableType2, left, right);
if (method != null)
{
return method;
}
}
}
if (oper_name != null)
{
method = Expression.GetBinaryOperator(oper_name, notNullableType, left, right);
if (method != null)
{
return method;
}
}
if (oper_name == "op_Equality" || oper_name == "op_Inequality")
{
if (!type.IsValueType && !type2.IsValueType)
{
return null;
}
if (type == type2 && notNullableType.IsEnum)
{
return null;
}
if (type == type2 && notNullableType == typeof(bool))
{
return null;
}
}
if ((oper_name == "op_LeftShift" || oper_name == "op_RightShift") && Expression.IsInt(notNullableType) && notNullableType2 == typeof(int))
{
return null;
}
throw new InvalidOperationException(string.Format("Operation {0} not defined for {1} and {2}", (oper_name == null) ? "is" : oper_name.Substring(3), type, type2));
}
}
// Token: 0x0600001A RID: 26 RVA: 0x0000275C File Offset: 0x0000095C
private static MethodInfo BinaryBitwiseCoreCheck(string oper_name, Expression left, Expression right, MethodInfo method)
{
if (left == null)
{
throw new ArgumentNullException("left");
}
if (right == null)
{
throw new ArgumentNullException("right");
}
if (method == null && left.Type == right.Type && Expression.IsIntOrBool(left.Type))
{
return null;
}
method = Expression.BinaryCoreCheck(oper_name, left, right, method);
if (method == null && (left.Type == typeof(double) || left.Type == typeof(float)))
{
throw new InvalidOperationException("Types not supported");
}
return method;
}
// Token: 0x0600001B RID: 27 RVA: 0x000027FC File Offset: 0x000009FC
private static BinaryExpression MakeSimpleBinary(ExpressionType et, Expression left, Expression right, MethodInfo method)
{
bool flag;
Type type;
if (method == null)
{
flag = left.Type.IsNullable();
type = left.Type;
}
else
{
ParameterInfo[] parameters = method.GetParameters();
ParameterInfo parameterInfo = parameters[0];
ParameterInfo parameterInfo2 = parameters[1];
if (Expression.IsAssignableToOperatorParameter(left, parameterInfo) && Expression.IsAssignableToOperatorParameter(right, parameterInfo2))
{
flag = false;
type = method.ReturnType;
}
else
{
if (!left.Type.IsNullable() || !right.Type.IsNullable() || left.Type.GetNotNullableType() != parameterInfo.ParameterType || right.Type.GetNotNullableType() != parameterInfo2.ParameterType || method.ReturnType.IsNullable())
{
throw new InvalidOperationException();
}
flag = true;
type = method.ReturnType.MakeNullableType();
}
}
return new BinaryExpression(et, type, left, right, flag, flag, method, null);
}
// Token: 0x0600001C RID: 28 RVA: 0x000028E4 File Offset: 0x00000AE4
private static bool IsAssignableToOperatorParameter(Expression expression, ParameterInfo parameter)
{
return expression.Type == parameter.ParameterType || (!expression.Type.IsNullable() && !parameter.ParameterType.IsNullable() && Expression.IsAssignableToParameterType(expression.Type, parameter));
}
// Token: 0x0600001D RID: 29 RVA: 0x00002938 File Offset: 0x00000B38
private static UnaryExpression MakeSimpleUnary(ExpressionType et, Expression expression, MethodInfo method)
{
Type type;
bool flag;
if (method == null)
{
type = expression.Type;
flag = type.IsNullable();
}
else
{
ParameterInfo parameterInfo = method.GetParameters()[0];
if (Expression.IsAssignableToOperatorParameter(expression, parameterInfo))
{
flag = false;
type = method.ReturnType;
}
else
{
if (!expression.Type.IsNullable() || expression.Type.GetNotNullableType() != parameterInfo.ParameterType || method.ReturnType.IsNullable())
{
throw new InvalidOperationException();
}
flag = true;
type = method.ReturnType.MakeNullableType();
}
}
return new UnaryExpression(et, expression, type, method, flag);
}
// Token: 0x0600001E RID: 30 RVA: 0x000029DC File Offset: 0x00000BDC
private static BinaryExpression MakeBoolBinary(ExpressionType et, Expression left, Expression right, bool liftToNull, MethodInfo method)
{
bool flag;
Type type;
if (method == null)
{
if (!left.Type.IsNullable() && !right.Type.IsNullable())
{
flag = false;
liftToNull = false;
type = typeof(bool);
}
else
{
if (!left.Type.IsNullable() || !right.Type.IsNullable())
{
throw new InvalidOperationException();
}
flag = true;
type = ((!liftToNull) ? typeof(bool) : typeof(bool?));
}
}
else
{
ParameterInfo[] parameters = method.GetParameters();
ParameterInfo parameterInfo = parameters[0];
ParameterInfo parameterInfo2 = parameters[1];
if (Expression.IsAssignableToOperatorParameter(left, parameterInfo) && Expression.IsAssignableToOperatorParameter(right, parameterInfo2))
{
flag = false;
liftToNull = false;
type = method.ReturnType;
}
else
{
if (!left.Type.IsNullable() || !right.Type.IsNullable() || left.Type.GetNotNullableType() != parameterInfo.ParameterType || right.Type.GetNotNullableType() != parameterInfo2.ParameterType)
{
throw new InvalidOperationException();
}
flag = true;
if (method.ReturnType == typeof(bool))
{
type = ((!liftToNull) ? typeof(bool) : typeof(bool?));
}
else
{
if (method.ReturnType.IsNullable())
{
throw new InvalidOperationException();
}
type = method.ReturnType.MakeNullableType();
}
}
}
return new BinaryExpression(et, type, left, right, liftToNull, flag, method, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that does not have overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Add" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600001F RID: 31 RVA: 0x00002B80 File Offset: 0x00000D80
public static BinaryExpression Add(Expression left, Expression right)
{
return Expression.Add(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that does not have overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Add" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000020 RID: 32 RVA: 0x00002B8C File Offset: 0x00000D8C
public static BinaryExpression Add(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Addition", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Add, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that has overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AddChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000021 RID: 33 RVA: 0x00002BA8 File Offset: 0x00000DA8
public static BinaryExpression AddChecked(Expression left, Expression right)
{
return Expression.AddChecked(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that has overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AddChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000022 RID: 34 RVA: 0x00002BB4 File Offset: 0x00000DB4
public static BinaryExpression AddChecked(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Addition", left, right, method);
if (method == null && (left.Type == typeof(byte) || left.Type == typeof(sbyte)))
{
throw new InvalidOperationException(string.Format("AddChecked not defined for {0} and {1}", left.Type, right.Type));
}
return Expression.MakeSimpleBinary(ExpressionType.AddChecked, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that does not have overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Subtract" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000023 RID: 35 RVA: 0x00002C28 File Offset: 0x00000E28
public static BinaryExpression Subtract(Expression left, Expression right)
{
return Expression.Subtract(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that does not have overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Subtract" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000024 RID: 36 RVA: 0x00002C34 File Offset: 0x00000E34
public static BinaryExpression Subtract(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Subtraction", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Subtract, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that has overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.SubtractChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000025 RID: 37 RVA: 0x00002C50 File Offset: 0x00000E50
public static BinaryExpression SubtractChecked(Expression left, Expression right)
{
return Expression.SubtractChecked(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that has overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.SubtractChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000026 RID: 38 RVA: 0x00002C5C File Offset: 0x00000E5C
public static BinaryExpression SubtractChecked(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Subtraction", left, right, method);
if (method == null && (left.Type == typeof(byte) || left.Type == typeof(sbyte)))
{
throw new InvalidOperationException(string.Format("SubtractChecked not defined for {0} and {1}", left.Type, right.Type));
}
return Expression.MakeSimpleBinary(ExpressionType.SubtractChecked, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic remainder operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Modulo" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The modulus operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000027 RID: 39 RVA: 0x00002CD0 File Offset: 0x00000ED0
public static BinaryExpression Modulo(Expression left, Expression right)
{
return Expression.Modulo(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic remainder operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Modulo" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the modulus operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000028 RID: 40 RVA: 0x00002CDC File Offset: 0x00000EDC
public static BinaryExpression Modulo(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Modulus", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Modulo, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that does not have overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Multiply" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000029 RID: 41 RVA: 0x00002CF8 File Offset: 0x00000EF8
public static BinaryExpression Multiply(Expression left, Expression right)
{
return Expression.Multiply(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that does not have overflow checking and for which the implementing method is specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Multiply" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600002A RID: 42 RVA: 0x00002D04 File Offset: 0x00000F04
public static BinaryExpression Multiply(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Multiply", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Multiply, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that has overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MultiplyChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600002B RID: 43 RVA: 0x00002D20 File Offset: 0x00000F20
public static BinaryExpression MultiplyChecked(Expression left, Expression right)
{
return Expression.MultiplyChecked(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that has overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MultiplyChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600002C RID: 44 RVA: 0x00002D2C File Offset: 0x00000F2C
public static BinaryExpression MultiplyChecked(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Multiply", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.MultiplyChecked, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic division operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Divide" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The division operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600002D RID: 45 RVA: 0x00002D48 File Offset: 0x00000F48
public static BinaryExpression Divide(Expression left, Expression right)
{
return Expression.Divide(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic division operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Divide" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the division operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600002E RID: 46 RVA: 0x00002D54 File Offset: 0x00000F54
public static BinaryExpression Divide(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Division", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Divide, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents raising a number to a power.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Power" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The exponentiation operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and/or <paramref name="right" />.Type are not <see cref="T:System.Double" />.</exception>
// Token: 0x0600002F RID: 47 RVA: 0x00002D70 File Offset: 0x00000F70
public static BinaryExpression Power(Expression left, Expression right)
{
return Expression.Power(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents raising a number to a power. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Power" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the exponentiation operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and/or <paramref name="right" />.Type are not <see cref="T:System.Double" />.</exception>
// Token: 0x06000030 RID: 48 RVA: 0x00002D7C File Offset: 0x00000F7C
public static BinaryExpression Power(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck(null, left, right, method);
if (left.Type.GetNotNullableType() != typeof(double))
{
throw new InvalidOperationException("Power only supports double arguments");
}
return Expression.MakeSimpleBinary(ExpressionType.Power, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise AND operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.And" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000031 RID: 49 RVA: 0x00002DC4 File Offset: 0x00000FC4
public static BinaryExpression And(Expression left, Expression right)
{
return Expression.And(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise AND operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.And" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000032 RID: 50 RVA: 0x00002DD0 File Offset: 0x00000FD0
public static BinaryExpression And(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryBitwiseCoreCheck("op_BitwiseAnd", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.And, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise OR operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Or" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000033 RID: 51 RVA: 0x00002DEC File Offset: 0x00000FEC
public static BinaryExpression Or(Expression left, Expression right)
{
return Expression.Or(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise OR operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Or" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000034 RID: 52 RVA: 0x00002DF8 File Offset: 0x00000FF8
public static BinaryExpression Or(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryBitwiseCoreCheck("op_BitwiseOr", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.Or, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise XOR operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ExclusiveOr" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The XOR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000035 RID: 53 RVA: 0x00002E14 File Offset: 0x00001014
public static BinaryExpression ExclusiveOr(Expression left, Expression right)
{
return Expression.ExclusiveOr(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise XOR operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ExclusiveOr" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the XOR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000036 RID: 54 RVA: 0x00002E20 File Offset: 0x00001020
public static BinaryExpression ExclusiveOr(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryBitwiseCoreCheck("op_ExclusiveOr", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.ExclusiveOr, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise left-shift operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LeftShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The left-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000037 RID: 55 RVA: 0x00002E3C File Offset: 0x0000103C
public static BinaryExpression LeftShift(Expression left, Expression right)
{
return Expression.LeftShift(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise left-shift operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LeftShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the left-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000038 RID: 56 RVA: 0x00002E48 File Offset: 0x00001048
public static BinaryExpression LeftShift(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryBitwiseCoreCheck("op_LeftShift", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.LeftShift, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise right-shift operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.RightShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The right-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000039 RID: 57 RVA: 0x00002E64 File Offset: 0x00001064
public static BinaryExpression RightShift(Expression left, Expression right)
{
return Expression.RightShift(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise right-shift operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.RightShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the right-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600003A RID: 58 RVA: 0x00002E70 File Offset: 0x00001070
public static BinaryExpression RightShift(Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_RightShift", left, right, method);
return Expression.MakeSimpleBinary(ExpressionType.RightShift, left, right, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional AND operation that evaluates the second operand only if it has to.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AndAlso" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
// Token: 0x0600003B RID: 59 RVA: 0x00002E8C File Offset: 0x0000108C
public static BinaryExpression AndAlso(Expression left, Expression right)
{
return Expression.AndAlso(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional AND operation that evaluates the second operand only if it has to. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AndAlso" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
// Token: 0x0600003C RID: 60 RVA: 0x00002E98 File Offset: 0x00001098
public static BinaryExpression AndAlso(Expression left, Expression right, MethodInfo method)
{
method = Expression.ConditionalBinaryCheck("op_BitwiseAnd", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.AndAlso, left, right, true, method);
}
// Token: 0x0600003D RID: 61 RVA: 0x00002EB4 File Offset: 0x000010B4
private static MethodInfo ConditionalBinaryCheck(string oper, Expression left, Expression right, MethodInfo method)
{
method = Expression.BinaryCoreCheck(oper, left, right, method);
if (method == null)
{
if (left.Type.GetNotNullableType() != typeof(bool))
{
throw new InvalidOperationException("Only booleans are allowed");
}
}
else
{
Type notNullableType = left.Type.GetNotNullableType();
if (left.Type != right.Type || method.ReturnType != notNullableType)
{
throw new ArgumentException("left, right and return type must match");
}
MethodInfo trueOperator = Expression.GetTrueOperator(notNullableType);
MethodInfo falseOperator = Expression.GetFalseOperator(notNullableType);
if (trueOperator == null || falseOperator == null)
{
throw new ArgumentException("Operators true and false are required but not defined");
}
}
return method;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional OR operation that evaluates the second operand only if it has to.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.OrElse" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
// Token: 0x0600003E RID: 62 RVA: 0x00002F58 File Offset: 0x00001158
public static BinaryExpression OrElse(Expression left, Expression right)
{
return Expression.OrElse(left, right, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional OR operation that evaluates the second operand only if it has to. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.OrElse" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
// Token: 0x0600003F RID: 63 RVA: 0x00002F64 File Offset: 0x00001164
public static BinaryExpression OrElse(Expression left, Expression right, MethodInfo method)
{
method = Expression.ConditionalBinaryCheck("op_BitwiseOr", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.OrElse, left, right, true, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an equality comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Equal" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The equality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000040 RID: 64 RVA: 0x00002F80 File Offset: 0x00001180
public static BinaryExpression Equal(Expression left, Expression right)
{
return Expression.Equal(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an equality comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Equal" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the equality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000041 RID: 65 RVA: 0x00002F8C File Offset: 0x0000118C
public static BinaryExpression Equal(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Equality", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.Equal, left, right, liftToNull, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an inequality comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NotEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The inequality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000042 RID: 66 RVA: 0x00002FA8 File Offset: 0x000011A8
public static BinaryExpression NotEqual(Expression left, Expression right)
{
return Expression.NotEqual(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an inequality comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NotEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the inequality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000043 RID: 67 RVA: 0x00002FB4 File Offset: 0x000011B4
public static BinaryExpression NotEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_Inequality", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.NotEqual, left, right, liftToNull, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than" numeric comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The "greater than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000044 RID: 68 RVA: 0x00002FD0 File Offset: 0x000011D0
public static BinaryExpression GreaterThan(Expression left, Expression right)
{
return Expression.GreaterThan(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than" numeric comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the "greater than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000045 RID: 69 RVA: 0x00002FDC File Offset: 0x000011DC
public static BinaryExpression GreaterThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_GreaterThan", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.GreaterThan, left, right, liftToNull, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than or equal" numeric comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The "greater than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000046 RID: 70 RVA: 0x00002FF8 File Offset: 0x000011F8
public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right)
{
return Expression.GreaterThanOrEqual(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than or equal" numeric comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the "greater than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000047 RID: 71 RVA: 0x00003004 File Offset: 0x00001204
public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_GreaterThanOrEqual", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.GreaterThanOrEqual, left, right, liftToNull, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "less than" numeric comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The "less than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000048 RID: 72 RVA: 0x00003020 File Offset: 0x00001220
public static BinaryExpression LessThan(Expression left, Expression right)
{
return Expression.LessThan(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "less than" numeric comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the "less than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x06000049 RID: 73 RVA: 0x0000302C File Offset: 0x0000122C
public static BinaryExpression LessThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_LessThan", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.LessThan, left, right, liftToNull, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a " less than or equal" numeric comparison.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The "less than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600004A RID: 74 RVA: 0x00003048 File Offset: 0x00001248
public static BinaryExpression LessThanOrEqual(Expression left, Expression right)
{
return Expression.LessThanOrEqual(left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a " less than or equal" numeric comparison. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the "less than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
// Token: 0x0600004B RID: 75 RVA: 0x00003054 File Offset: 0x00001254
public static BinaryExpression LessThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
{
method = Expression.BinaryCoreCheck("op_LessThanOrEqual", left, right, method);
return Expression.MakeBoolBinary(ExpressionType.LessThanOrEqual, left, right, liftToNull, method);
}
// Token: 0x0600004C RID: 76 RVA: 0x00003070 File Offset: 0x00001270
private static void CheckArray(Expression array)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (!array.Type.IsArray)
{
throw new ArgumentException("The array argument must be of type array");
}
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents applying an array index operator to an array of rank one.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ArrayIndex" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="index">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> or <paramref name="index" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" />.Type does not represent an array type.-or-<paramref name="array" />.Type represents an array type whose rank is not 1.-or-<paramref name="index" />.Type does not represent the <see cref="T:System.Int32" /> type.</exception>
// Token: 0x0600004D RID: 77 RVA: 0x000030AC File Offset: 0x000012AC
public static BinaryExpression ArrayIndex(Expression array, Expression index)
{
Expression.CheckArray(array);
if (index == null)
{
throw new ArgumentNullException("index");
}
if (array.Type.GetArrayRank() != 1)
{
throw new ArgumentException("The array argument must be a single dimensional array");
}
if (index.Type != typeof(int))
{
throw new ArgumentException("The index must be of type int");
}
return new BinaryExpression(ExpressionType.ArrayIndex, array.Type.GetElementType(), array, index);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a coalescing operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> does not represent a reference type or a nullable value type.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="left" />.Type and <paramref name="right" />.Type are not convertible to each other.</exception>
// Token: 0x0600004E RID: 78 RVA: 0x00003120 File Offset: 0x00001320
public static BinaryExpression Coalesce(Expression left, Expression right)
{
return Expression.Coalesce(left, right, null);
}
// Token: 0x0600004F RID: 79 RVA: 0x0000312C File Offset: 0x0000132C
private static BinaryExpression MakeCoalesce(Expression left, Expression right)
{
Type type = null;
if (left.Type.IsNullable())
{
Type notNullableType = left.Type.GetNotNullableType();
if (!right.Type.IsNullable() && right.Type.IsAssignableTo(notNullableType))
{
type = notNullableType;
}
}
if (type == null && right.Type.IsAssignableTo(left.Type))
{
type = left.Type;
}
if (type == null && left.Type.IsNullable() && left.Type.GetNotNullableType().IsAssignableTo(right.Type))
{
type = right.Type;
}
if (type == null)
{
throw new ArgumentException("Incompatible argument types");
}
return new BinaryExpression(ExpressionType.Coalesce, type, left, right, false, false, null, null);
}
// Token: 0x06000050 RID: 80 RVA: 0x000031F4 File Offset: 0x000013F4
private static BinaryExpression MakeConvertedCoalesce(Expression left, Expression right, LambdaExpression conversion)
{
MethodInfo invokeMethod = conversion.Type.GetInvokeMethod();
Expression.CheckNotVoid(invokeMethod.ReturnType);
if (invokeMethod.ReturnType != right.Type)
{
throw new InvalidOperationException("Conversion return type doesn't march right type");
}
ParameterInfo[] parameters = invokeMethod.GetParameters();
if (parameters.Length != 1)
{
throw new ArgumentException("Conversion has wrong number of parameters");
}
if (!Expression.IsAssignableToParameterType(left.Type, parameters[0]))
{
throw new InvalidOperationException("Conversion argument doesn't marcht left type");
}
return new BinaryExpression(ExpressionType.Coalesce, right.Type, left, right, false, false, null, conversion);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a coalescing operation, given a conversion function.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Conversion" /> properties set to the specified values.</returns>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
/// <param name="conversion">A <see cref="T:System.Linq.Expressions.LambdaExpression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Conversion" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="left" />.Type and <paramref name="right" />.Type are not convertible to each other.-or-<paramref name="conversion" /> is not null and <paramref name="conversion" />.Type is a delegate type that does not take exactly one argument.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> does not represent a reference type or a nullable value type.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> represents a type that is not assignable to the parameter type of the delegate type <paramref name="conversion" />.Type.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="right" /> is not equal to the return type of the delegate type <paramref name="conversion" />.Type.</exception>
// Token: 0x06000051 RID: 81 RVA: 0x00003280 File Offset: 0x00001480
public static BinaryExpression Coalesce(Expression left, Expression right, LambdaExpression conversion)
{
if (left == null)
{
throw new ArgumentNullException("left");
}
if (right == null)
{
throw new ArgumentNullException("right");
}
if (left.Type.IsValueType && !left.Type.IsNullable())
{
throw new InvalidOperationException("Left expression can never be null");
}
if (conversion != null)
{
return Expression.MakeConvertedCoalesce(left, right, conversion);
}
return Expression.MakeCoalesce(left, right);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left and right operands, by calling an appropriate factory method.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
// Token: 0x06000052 RID: 82 RVA: 0x000032F0 File Offset: 0x000014F0
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right)
{
return Expression.MakeBinary(binaryType, left, right, false, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left operand, right operand and implementing method, by calling the appropriate factory method.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that specifies the implementing method.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
// Token: 0x06000053 RID: 83 RVA: 0x000032FC File Offset: 0x000014FC
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
{
return Expression.MakeBinary(binaryType, left, right, liftToNull, method, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left operand, right operand, implementing method and type conversion function, by calling the appropriate factory method.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that specifies the implementing method.</param>
/// <param name="conversion">A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that represents a type conversion function. This parameter is used only if <paramref name="binaryType" /> is <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" />.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
// Token: 0x06000054 RID: 84 RVA: 0x0000330C File Offset: 0x0000150C
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
{
switch (binaryType)
{
case ExpressionType.Add:
return Expression.Add(left, right, method);
case ExpressionType.AddChecked:
return Expression.AddChecked(left, right, method);
case ExpressionType.And:
return Expression.And(left, right, method);
case ExpressionType.AndAlso:
return Expression.AndAlso(left, right);
case ExpressionType.Coalesce:
return Expression.Coalesce(left, right, conversion);
case ExpressionType.Divide:
return Expression.Divide(left, right, method);
case ExpressionType.Equal:
return Expression.Equal(left, right, liftToNull, method);
case ExpressionType.ExclusiveOr:
return Expression.ExclusiveOr(left, right, method);
case ExpressionType.GreaterThan:
return Expression.GreaterThan(left, right, liftToNull, method);
case ExpressionType.GreaterThanOrEqual:
return Expression.GreaterThanOrEqual(left, right, liftToNull, method);
case ExpressionType.LeftShift:
return Expression.LeftShift(left, right, method);
case ExpressionType.LessThan:
return Expression.LessThan(left, right, liftToNull, method);
case ExpressionType.LessThanOrEqual:
return Expression.LessThanOrEqual(left, right, liftToNull, method);
case ExpressionType.Modulo:
return Expression.Modulo(left, right, method);
case ExpressionType.Multiply:
return Expression.Multiply(left, right, method);
case ExpressionType.MultiplyChecked:
return Expression.MultiplyChecked(left, right, method);
case ExpressionType.NotEqual:
return Expression.NotEqual(left, right, liftToNull, method);
case ExpressionType.Or:
return Expression.Or(left, right, method);
case ExpressionType.OrElse:
return Expression.OrElse(left, right);
case ExpressionType.Power:
return Expression.Power(left, right, method);
case ExpressionType.RightShift:
return Expression.RightShift(left, right, method);
case ExpressionType.Subtract:
return Expression.Subtract(left, right, method);
case ExpressionType.SubtractChecked:
return Expression.SubtractChecked(left, right, method);
}
throw new ArgumentException("MakeBinary expect a binary node type");
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents applying an array index operator to an array of rank more than one.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to.</param>
/// <param name="indexes">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> or <paramref name="indexes" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" />.Type does not represent an array type.-or-The rank of <paramref name="array" />.Type does not match the number of elements in <paramref name="indexes" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="indexes" /> does not represent the <see cref="T:System.Int32" /> type.</exception>
// Token: 0x06000055 RID: 85 RVA: 0x000034C8 File Offset: 0x000016C8
public static MethodCallExpression ArrayIndex(Expression array, params Expression[] indexes)
{
return Expression.ArrayIndex(array, indexes);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents applying an array index operator to an array of rank more than one.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to.</param>
/// <param name="indexes">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> or <paramref name="indexes" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" />.Type does not represent an array type.-or-The rank of <paramref name="array" />.Type does not match the number of elements in <paramref name="indexes" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="indexes" /> does not represent the <see cref="T:System.Int32" /> type.</exception>
// Token: 0x06000056 RID: 86 RVA: 0x000034D4 File Offset: 0x000016D4
public static MethodCallExpression ArrayIndex(Expression array, IEnumerable<Expression> indexes)
{
Expression.CheckArray(array);
if (indexes == null)
{
throw new ArgumentNullException("indexes");
}
ReadOnlyCollection<Expression> readOnlyCollection = indexes.ToReadOnlyCollection<Expression>();
if (array.Type.GetArrayRank() != readOnlyCollection.Count)
{
throw new ArgumentException("The number of arguments doesn't match the rank of the array");
}
foreach (Expression expression in readOnlyCollection)
{
if (expression.Type != typeof(int))
{
throw new ArgumentException("The index must be of type int");
}
}
return Expression.Call(array, array.Type.GetMethod("Get", BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy), readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents getting the length of a one-dimensional array.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ArrayLength" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to <paramref name="array" />.</returns>
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" />.Type does not represent an array type.</exception>
// Token: 0x06000057 RID: 87 RVA: 0x000035A4 File Offset: 0x000017A4
public static UnaryExpression ArrayLength(Expression array)
{
if (array == null)
{
throw new ArgumentNullException("array");
}
if (!array.Type.IsArray)
{
throw new ArgumentException("The type of the expression must me Array");
}
if (array.Type.GetArrayRank() != 1)
{
throw new ArgumentException("The array must be a single dimensional array");
}
return new UnaryExpression(ExpressionType.ArrayLength, array, typeof(int));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberAssignment" /> that represents the initialization of a field or property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberAssignment" /> that has <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> equal to <see cref="F:System.Linq.Expressions.MemberBindingType.Assignment" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> properties set to the specified values.</returns>
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="member" /> or <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.-or-The property represented by <paramref name="member" /> does not have a set accessor.-or-<paramref name="expression" />.Type is not assignable to the type of the field or property that <paramref name="member" /> represents.</exception>
// Token: 0x06000058 RID: 88 RVA: 0x0000360C File Offset: 0x0000180C
public static MemberAssignment Bind(MemberInfo member, Expression expression)
{
if (member == null)
{
throw new ArgumentNullException("member");
}
if (expression == null)
{
throw new ArgumentNullException("expression");
}
Type type = null;
PropertyInfo propertyInfo = member as PropertyInfo;
if (propertyInfo != null && propertyInfo.GetSetMethod(true) != null)
{
type = propertyInfo.PropertyType;
}
FieldInfo fieldInfo = member as FieldInfo;
if (fieldInfo != null)
{
type = fieldInfo.FieldType;
}
if (type == null)
{
throw new ArgumentException("member");
}
if (!expression.Type.IsAssignableTo(type))
{
throw new ArgumentException("member");
}
return new MemberAssignment(member, expression);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberAssignment" /> that represents the initialization of a member by using a property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberAssignment" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.Assignment" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property set to <paramref name="expression" />.</returns>
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> or <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The property accessed by <paramref name="propertyAccessor" /> does not have a set accessor.-or-<paramref name="expression" />.Type is not assignable to the type of the field or property that <paramref name="member" /> represents.</exception>
// Token: 0x06000059 RID: 89 RVA: 0x000036A8 File Offset: 0x000018A8
public static MemberAssignment Bind(MethodInfo propertyAccessor, Expression expression)
{
if (propertyAccessor == null)
{
throw new ArgumentNullException("propertyAccessor");
}
if (expression == null)
{
throw new ArgumentNullException("expression");
}
Expression.CheckNonGenericMethod(propertyAccessor);
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
if (associatedProperty == null)
{
throw new ArgumentException("propertyAccessor");
}
if (associatedProperty.GetSetMethod(true) == null)
{
throw new ArgumentException("setter");
}
if (!expression.Type.IsAssignableTo(associatedProperty.PropertyType))
{
throw new ArgumentException("member");
}
return new MemberAssignment(associatedProperty, expression);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes no arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> properties set to the specified values.</returns>
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.</exception>
// Token: 0x0600005A RID: 90 RVA: 0x00003738 File Offset: 0x00001938
public static MethodCallExpression Call(Expression instance, MethodInfo method)
{
return Expression.Call(instance, method, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a static (Shared in Visual Basic) method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that represents a static (Shared in Visual Basic) method to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="method" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
// Token: 0x0600005B RID: 91 RVA: 0x00003744 File Offset: 0x00001944
public static MethodCallExpression Call(MethodInfo method, params Expression[] arguments)
{
return Expression.Call(null, method, arguments);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" />, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.-or-<paramref name="arguments" /> is not null and one or more of its elements is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.-or-The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
// Token: 0x0600005C RID: 92 RVA: 0x00003750 File Offset: 0x00001950
public static MethodCallExpression Call(Expression instance, MethodInfo method, params Expression[] arguments)
{
return Expression.Call(instance, method, arguments);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" />, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.-or-The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
// Token: 0x0600005D RID: 93 RVA: 0x0000375C File Offset: 0x0000195C
public static MethodCallExpression Call(Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
{
if (method == null)
{
throw new ArgumentNullException("method");
}
if (instance == null && !method.IsStatic)
{
throw new ArgumentNullException("instance");
}
if (method.IsStatic && instance != null)
{
throw new ArgumentException("instance");
}
if (!method.IsStatic && !instance.Type.IsAssignableTo(method.DeclaringType))
{
throw new ArgumentException("Type is not assignable to the declaring type of the method");
}
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(method, arguments);
return new MethodCallExpression(instance, method, readOnlyCollection);
}
// Token: 0x0600005E RID: 94 RVA: 0x000037F0 File Offset: 0x000019F0
private static Type[] CollectTypes(IEnumerable<Expression> expressions)
{
return expressions.Select((Expression arg) => arg.Type).ToArray<Type>();
}
// Token: 0x0600005F RID: 95 RVA: 0x00003828 File Offset: 0x00001A28
private static MethodInfo TryMakeGeneric(MethodInfo method, Type[] args)
{
if (method == null)
{
return null;
}
if (!method.IsGenericMethod && (args == null || args.Length == 0))
{
return method;
}
if (args.Length == method.GetGenericArguments().Length)
{
return method.MakeGenericMethod(args);
}
return null;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to an instance method by calling the appropriate factory method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" />, the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to <paramref name="instance" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> set to the <see cref="T:System.Reflection.MethodInfo" /> that represents the specified instance method, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> set to the specified arguments.</returns>
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> property value will be searched for a specific method.</param>
/// <param name="methodName">The name of the method.</param>
/// <param name="typeArguments">An array of <see cref="T:System.Type" /> objects that specify the type parameters of the method.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects that represents the arguments to the method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="instance" /> or <paramref name="methodName" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">No method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="instance" />.Type or its base types.-or-More than one method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="instance" />.Type or its base types.</exception>
// Token: 0x06000060 RID: 96 RVA: 0x00003874 File Offset: 0x00001A74
public static MethodCallExpression Call(Expression instance, string methodName, Type[] typeArguments, params Expression[] arguments)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
if (methodName == null)
{
throw new ArgumentNullException("methodName");
}
MethodInfo methodInfo = Expression.TryGetMethod(instance.Type, methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, Expression.CollectTypes(arguments), typeArguments);
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(methodInfo, arguments);
return new MethodCallExpression(instance, methodInfo, readOnlyCollection);
}
// Token: 0x06000061 RID: 97 RVA: 0x000038CC File Offset: 0x00001ACC
private static bool MethodMatch(MethodInfo method, string name, Type[] parameterTypes, Type[] argumentTypes)
{
if (method.Name != name)
{
return false;
}
ParameterInfo[] parameters = method.GetParameters();
if (parameters.Length != parameterTypes.Length)
{
return false;
}
if (method.IsGenericMethod && method.IsGenericMethodDefinition)
{
MethodInfo methodInfo = Expression.TryMakeGeneric(method, argumentTypes);
return methodInfo != null && Expression.MethodMatch(methodInfo, name, parameterTypes, argumentTypes);
}
if (!method.IsGenericMethod && argumentTypes != null && argumentTypes.Length > 0)
{
return false;
}
for (int i = 0; i < parameters.Length; i++)
{
Type type = parameterTypes[i];
ParameterInfo parameterInfo = parameters[i];
if (!Expression.IsAssignableToParameterType(type, parameterInfo) && !Expression.IsExpressionOfParameter(type, parameterInfo.ParameterType))
{
return false;
}
}
return true;
}
// Token: 0x06000062 RID: 98 RVA: 0x0000398C File Offset: 0x00001B8C
private static bool IsExpressionOfParameter(Type type, Type ptype)
{
return ptype.IsGenericInstanceOf(typeof(Expression<>)) && ptype.GetFirstGenericArgument() == type;
}
// Token: 0x06000063 RID: 99 RVA: 0x000039B0 File Offset: 0x00001BB0
private static MethodInfo TryGetMethod(Type type, string methodName, BindingFlags flags, Type[] parameterTypes, Type[] argumentTypes)
{
IEnumerable<MethodInfo> enumerable = from meth in type.GetMethods(flags)
where Expression.MethodMatch(meth, methodName, parameterTypes, argumentTypes)
select meth;
if (enumerable.Count<MethodInfo>() > 1)
{
throw new InvalidOperationException("Too many method candidates");
}
MethodInfo methodInfo = Expression.TryMakeGeneric(enumerable.FirstOrDefault<MethodInfo>(), argumentTypes);
if (methodInfo != null)
{
return methodInfo;
}
throw new InvalidOperationException("No such method");
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a static (Shared in Visual Basic) method by calling the appropriate factory method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" />, the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property set to the <see cref="T:System.Reflection.MethodInfo" /> that represents the specified static (Shared in Visual Basic) method, and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> property set to the specified arguments.</returns>
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type that contains the specified static (Shared in Visual Basic) method.</param>
/// <param name="methodName">The name of the method.</param>
/// <param name="typeArguments">An array of <see cref="T:System.Type" /> objects that specify the type parameters of the method.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments to the method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="methodName" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">No method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="type" /> or its base types.-or-More than one method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="type" /> or its base types.</exception>
// Token: 0x06000064 RID: 100 RVA: 0x00003A30 File Offset: 0x00001C30
public static MethodCallExpression Call(Type type, string methodName, Type[] typeArguments, params Expression[] arguments)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (methodName == null)
{
throw new ArgumentNullException("methodName");
}
MethodInfo methodInfo = Expression.TryGetMethod(type, methodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, Expression.CollectTypes(arguments), typeArguments);
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(methodInfo, arguments);
return new MethodCallExpression(methodInfo, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConditionalExpression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ConditionalExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Conditional" /> and the <see cref="P:System.Linq.Expressions.ConditionalExpression.Test" />, <see cref="P:System.Linq.Expressions.ConditionalExpression.IfTrue" />, and <see cref="P:System.Linq.Expressions.ConditionalExpression.IfFalse" /> properties set to the specified values.</returns>
/// <param name="test">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.Test" /> property equal to.</param>
/// <param name="ifTrue">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.IfTrue" /> property equal to.</param>
/// <param name="ifFalse">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.IfFalse" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="test" /> or <paramref name="ifTrue" /> or <paramref name="ifFalse" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="test" />.Type is not <see cref="T:System.Boolean" />.-or-<paramref name="ifTrue" />.Type is not equal to <paramref name="ifFalse" />.Type.</exception>
// Token: 0x06000065 RID: 101 RVA: 0x00003A80 File Offset: 0x00001C80
public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
{
if (test == null)
{
throw new ArgumentNullException("test");
}
if (ifTrue == null)
{
throw new ArgumentNullException("ifTrue");
}
if (ifFalse == null)
{
throw new ArgumentNullException("ifFalse");
}
if (test.Type != typeof(bool))
{
throw new ArgumentException("Test expression should be of type bool");
}
if (ifTrue.Type != ifFalse.Type)
{
throw new ArgumentException("The ifTrue and ifFalse type do not match");
}
return new ConditionalExpression(test, ifTrue, ifFalse);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property set to the specified value.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Constant" /> and the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property set to the specified value.</returns>
/// <param name="value">An <see cref="T:System.Object" /> to set the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property equal to.</param>
// Token: 0x06000066 RID: 102 RVA: 0x00003B04 File Offset: 0x00001D04
public static ConstantExpression Constant(object value)
{
if (value == null)
{
return new ConstantExpression(null, typeof(object));
}
return Expression.Constant(value, value.GetType());
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Constant" /> and the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
/// <param name="value">An <see cref="T:System.Object" /> to set the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="value" /> is not null and <paramref name="type" /> is not assignable from the dynamic type of <paramref name="value" />.</exception>
// Token: 0x06000067 RID: 103 RVA: 0x00003B2C File Offset: 0x00001D2C
public static ConstantExpression Constant(object value, Type type)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (value == null)
{
if (type.IsValueType && !type.IsNullable())
{
throw new ArgumentException();
}
}
else if ((!type.IsValueType || !type.IsNullable()) && !value.GetType().IsAssignableTo(type))
{
throw new ArgumentException();
}
return new ConstantExpression(value, type);
}
// Token: 0x06000068 RID: 104 RVA: 0x00003BA8 File Offset: 0x00001DA8
private static bool IsConvertiblePrimitive(Type type)
{
Type notNullableType = type.GetNotNullableType();
return notNullableType != typeof(bool) && (notNullableType.IsEnum || notNullableType.IsPrimitive);
}
// Token: 0x06000069 RID: 105 RVA: 0x00003BE4 File Offset: 0x00001DE4
internal static bool IsPrimitiveConversion(Type type, Type target)
{
return type == target || (type.IsNullable() && target == type.GetNotNullableType()) || (target.IsNullable() && type == target.GetNotNullableType()) || (Expression.IsConvertiblePrimitive(type) && Expression.IsConvertiblePrimitive(target));
}
// Token: 0x0600006A RID: 106 RVA: 0x00003C48 File Offset: 0x00001E48
internal static bool IsReferenceConversion(Type type, Type target)
{
return type == target || (type == typeof(object) || target == typeof(object)) || (type.IsInterface || target.IsInterface) || (!type.IsValueType && !target.IsValueType && (type.IsAssignableTo(target) || target.IsAssignableTo(type)));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Convert" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.</exception>
// Token: 0x0600006B RID: 107 RVA: 0x00003CCC File Offset: 0x00001ECC
public static UnaryExpression Convert(Expression expression, Type type)
{
return Expression.Convert(expression, type, null);
}
// Token: 0x0600006C RID: 108 RVA: 0x00003CD8 File Offset: 0x00001ED8
private static MethodInfo GetUserConversionMethod(Type type, Type target)
{
MethodInfo methodInfo = Expression.GetUnaryOperator("op_Explicit", type, type, target);
if (methodInfo == null)
{
methodInfo = Expression.GetUnaryOperator("op_Implicit", type, type, target);
}
if (methodInfo == null)
{
methodInfo = Expression.GetUnaryOperator("op_Explicit", target, type, target);
}
if (methodInfo == null)
{
methodInfo = Expression.GetUnaryOperator("op_Implicit", target, type, target);
}
if (methodInfo == null)
{
throw new InvalidOperationException();
}
return methodInfo;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation for which the implementing method is specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Convert" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" />, <see cref="P:System.Linq.Expressions.Expression.Type" />, and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.Reflection.AmbiguousMatchException">More than one method that matches the <paramref name="method" /> description was found.</exception>
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.-or-<paramref name="expression" />.Type is not assignable to the argument type of the method represented by <paramref name="method" />.-or-The return type of the method represented by <paramref name="method" /> is not assignable to <paramref name="type" />.-or-<paramref name="expression" />.Type or <paramref name="type" /> is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by <paramref name="method" />.</exception>
// Token: 0x0600006D RID: 109 RVA: 0x00003D3C File Offset: 0x00001F3C
public static UnaryExpression Convert(Expression expression, Type type, MethodInfo method)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
Type type2 = expression.Type;
if (method != null)
{
Expression.CheckUnaryMethod(method, type2);
}
else if (!Expression.IsPrimitiveConversion(type2, type) && !Expression.IsReferenceConversion(type2, type))
{
method = Expression.GetUserConversionMethod(type2, type);
}
return new UnaryExpression(ExpressionType.Convert, expression, type, method, Expression.IsConvertNodeLifted(method, expression, type));
}
// Token: 0x0600006E RID: 110 RVA: 0x00003DB8 File Offset: 0x00001FB8
private static bool IsConvertNodeLifted(MethodInfo method, Expression operand, Type target)
{
if (method == null)
{
return operand.Type.IsNullable() || target.IsNullable();
}
return (operand.Type.IsNullable() && !Expression.ParameterMatch(method, operand.Type)) || (target.IsNullable() && !Expression.ReturnTypeMatch(method, target));
}
// Token: 0x0600006F RID: 111 RVA: 0x00003E24 File Offset: 0x00002024
private static bool ParameterMatch(MethodInfo method, Type type)
{
return method.GetParameters()[0].ParameterType == type;
}
// Token: 0x06000070 RID: 112 RVA: 0x00003E38 File Offset: 0x00002038
private static bool ReturnTypeMatch(MethodInfo method, Type type)
{
return method.ReturnType == type;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation that throws an exception if the target type is overflowed.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ConvertChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.</exception>
// Token: 0x06000071 RID: 113 RVA: 0x00003E44 File Offset: 0x00002044
public static UnaryExpression ConvertChecked(Expression expression, Type type)
{
return Expression.ConvertChecked(expression, type, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation that throws an exception if the target type is overflowed and for which the implementing method is specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ConvertChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" />, <see cref="P:System.Linq.Expressions.Expression.Type" />, and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.Reflection.AmbiguousMatchException">More than one method that matches the <paramref name="method" /> description was found.</exception>
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.-or-<paramref name="expression" />.Type is not assignable to the argument type of the method represented by <paramref name="method" />.-or-The return type of the method represented by <paramref name="method" /> is not assignable to <paramref name="type" />.-or-<paramref name="expression" />.Type or <paramref name="type" /> is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by <paramref name="method" />.</exception>
// Token: 0x06000072 RID: 114 RVA: 0x00003E50 File Offset: 0x00002050
public static UnaryExpression ConvertChecked(Expression expression, Type type, MethodInfo method)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
Type type2 = expression.Type;
if (method != null)
{
Expression.CheckUnaryMethod(method, type2);
}
else
{
if (Expression.IsReferenceConversion(type2, type))
{
return Expression.Convert(expression, type, method);
}
if (!Expression.IsPrimitiveConversion(type2, type))
{
method = Expression.GetUserConversionMethod(type2, type);
}
}
return new UnaryExpression(ExpressionType.ConvertChecked, expression, type, method, Expression.IsConvertNodeLifted(method, expression, type));
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.ElementInit" />, given an array of values as the second argument.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.ElementInit" /> that has the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> and <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> properties set to the specified values.</returns>
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> property equal to.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to set the <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="addMethod" /> or <paramref name="arguments" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The method that addMethod represents is not named "Add" (case insensitive).-or-The method that addMethod represents is not an instance method.-or-arguments does not contain the same number of elements as the number of parameters for the method that addMethod represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the method that <paramref name="addMethod" /> represents.</exception>
// Token: 0x06000073 RID: 115 RVA: 0x00003ED8 File Offset: 0x000020D8
public static ElementInit ElementInit(MethodInfo addMethod, params Expression[] arguments)
{
return Expression.ElementInit(addMethod, arguments);
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.ElementInit" />, given an <see cref="T:System.Collections.Generic.IEnumerable`1" /> as the second argument.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.ElementInit" /> that has the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> and <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> properties set to the specified values.</returns>
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to set the <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="addMethod" /> or <paramref name="arguments" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The method that <paramref name="addMethod" /> represents is not named "Add" (case insensitive).-or-The method that <paramref name="addMethod" /> represents is not an instance method.-or-<paramref name="arguments" /> does not contain the same number of elements as the number of parameters for the method that <paramref name="addMethod" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the method that <paramref name="addMethod" /> represents.</exception>
// Token: 0x06000074 RID: 116 RVA: 0x00003EE4 File Offset: 0x000020E4
public static ElementInit ElementInit(MethodInfo addMethod, IEnumerable<Expression> arguments)
{
if (addMethod == null)
{
throw new ArgumentNullException("addMethod");
}
if (arguments == null)
{
throw new ArgumentNullException("arguments");
}
if (addMethod.Name.ToLower(CultureInfo.InvariantCulture) != "add")
{
throw new ArgumentException("addMethod");
}
if (addMethod.IsStatic)
{
throw new ArgumentException("addMethod must be an instance method", "addMethod");
}
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(addMethod, arguments);
return new ElementInit(addMethod, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a field.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> and <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
/// <param name="field">The <see cref="T:System.Reflection.FieldInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="field" /> is null.-or-The field represented by <paramref name="field" /> is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="expression" />.Type is not assignable to the declaring type of the field represented by <paramref name="field" />.</exception>
// Token: 0x06000075 RID: 117 RVA: 0x00003F68 File Offset: 0x00002168
public static MemberExpression Field(Expression expression, FieldInfo field)
{
if (field == null)
{
throw new ArgumentNullException("field");
}
if (!field.IsStatic)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (!expression.Type.IsAssignableTo(field.DeclaringType))
{
throw new ArgumentException("field");
}
}
else if (expression != null)
{
throw new ArgumentException("expression");
}
return new MemberExpression(expression, field, field.FieldType);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a field given the name of the field.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.FieldInfo" /> that represents the field denoted by <paramref name="fieldName" />.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a field named <paramref name="fieldName" />.</param>
/// <param name="fieldName">The name of a field.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="fieldName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">No field named <paramref name="fieldName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
// Token: 0x06000076 RID: 118 RVA: 0x00003FE8 File Offset: 0x000021E8
public static MemberExpression Field(Expression expression, string fieldName)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
FieldInfo field = expression.Type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
if (field == null)
{
throw new ArgumentException(string.Format("No field named {0} on {1}", fieldName, expression.Type));
}
return new MemberExpression(expression, field, field.FieldType);
}
/// <summary>Creates a <see cref="T:System.Type" /> object that represents a generic System.Action delegate type that has specific type arguments.</summary>
/// <returns>The type of a System.Action delegate that has the specified type arguments.</returns>
/// <param name="typeArgs">An array of zero to four <see cref="T:System.Type" /> objects that specify the type arguments for the System.Action delegate type.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="typeArgs" /> contains more than four elements.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="typeArgs" /> is null.</exception>
// Token: 0x06000077 RID: 119 RVA: 0x00004040 File Offset: 0x00002240
public static Type GetActionType(params Type[] typeArgs)
{
if (typeArgs == null)
{
throw new ArgumentNullException("typeArgs");
}
if (typeArgs.Length > 4)
{
throw new ArgumentException("No Action type of this arity");
}
if (typeArgs.Length == 0)
{
return typeof(Action);
}
Type type = null;
switch (typeArgs.Length)
{
case 1:
type = typeof(Action<>);
break;
case 2:
type = typeof(Action<, >);
break;
case 3:
type = typeof(Action<, , >);
break;
case 4:
type = typeof(Action<, , , >);
break;
}
return type.MakeGenericType(typeArgs);
}
/// <summary>Creates a <see cref="T:System.Type" /> object that represents a generic System.Func delegate type that has specific type arguments.</summary>
/// <returns>The type of a System.Func delegate that has the specified type arguments.</returns>
/// <param name="typeArgs">An array of one to five <see cref="T:System.Type" /> objects that specify the type arguments for the System.Func delegate type.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="typeArgs" /> contains less than one or more than five elements.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="typeArgs" /> is null.</exception>
// Token: 0x06000078 RID: 120 RVA: 0x000040F0 File Offset: 0x000022F0
public static Type GetFuncType(params Type[] typeArgs)
{
if (typeArgs == null)
{
throw new ArgumentNullException("typeArgs");
}
if (typeArgs.Length < 1 || typeArgs.Length > 5)
{
throw new ArgumentException("No Func type of this arity");
}
Type type = null;
switch (typeArgs.Length)
{
case 1:
type = typeof(Func<>);
break;
case 2:
type = typeof(Func<, >);
break;
case 3:
type = typeof(Func<, , >);
break;
case 4:
type = typeof(Func<, , , >);
break;
case 5:
type = typeof(Func<, , , , >);
break;
}
return type.MakeGenericType(typeArgs);
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.InvocationExpression" />.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.InvocationExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Invoke" /> and the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> and <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> property equal to.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="expression" />.Type does not represent a delegate type or an <see cref="T:System.Linq.Expressions.Expression`1" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the delegate represented by <paramref name="expression" />.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="arguments" /> does not contain the same number of elements as the list of parameters for the delegate represented by <paramref name="expression" />.</exception>
// Token: 0x06000079 RID: 121 RVA: 0x000041AC File Offset: 0x000023AC
public static InvocationExpression Invoke(Expression expression, params Expression[] arguments)
{
return Expression.Invoke(expression, arguments);
}
// Token: 0x0600007A RID: 122 RVA: 0x000041B8 File Offset: 0x000023B8
private static Type GetInvokableType(Type t)
{
if (t.IsAssignableTo(typeof(Delegate)))
{
return t;
}
return Expression.GetGenericType(t, typeof(Expression<>));
}
// Token: 0x0600007B RID: 123 RVA: 0x000041E4 File Offset: 0x000023E4
private static Type GetGenericType(Type t, Type def)
{
if (t == null)
{
return null;
}
if (t.IsGenericType && t.GetGenericTypeDefinition() == def)
{
return t;
}
return Expression.GetGenericType(t.BaseType, def);
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.InvocationExpression" />.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.InvocationExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Invoke" /> and the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> and <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="expression" />.Type does not represent a delegate type or an <see cref="T:System.Linq.Expressions.Expression`1" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the delegate represented by <paramref name="expression" />.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="arguments" /> does not contain the same number of elements as the list of parameters for the delegate represented by <paramref name="expression" />.</exception>
// Token: 0x0600007C RID: 124 RVA: 0x00004220 File Offset: 0x00002420
public static InvocationExpression Invoke(Expression expression, IEnumerable<Expression> arguments)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
Type invokableType = Expression.GetInvokableType(expression.Type);
if (invokableType == null)
{
throw new ArgumentException("The type of the expression is not invokable");
}
ReadOnlyCollection<Expression> readOnlyCollection = arguments.ToReadOnlyCollection<Expression>();
Expression.CheckForNull<Expression>(readOnlyCollection, "arguments");
MethodInfo invokeMethod = invokableType.GetInvokeMethod();
if (invokeMethod == null)
{
throw new ArgumentException("expression");
}
if (invokeMethod.GetParameters().Length != readOnlyCollection.Count)
{
throw new InvalidOperationException("Arguments count doesn't match parameters length");
}
readOnlyCollection = Expression.CheckMethodArguments(invokeMethod, readOnlyCollection);
return new InvocationExpression(expression, invokeMethod.ReturnType, readOnlyCollection);
}
// Token: 0x0600007D RID: 125 RVA: 0x000042B8 File Offset: 0x000024B8
private static bool CanAssign(Type target, Type source)
{
return !(target.IsValueType ^ source.IsValueType) && source.IsAssignableTo(target);
}
// Token: 0x0600007E RID: 126 RVA: 0x000042D8 File Offset: 0x000024D8
private static Expression CheckLambda(Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
{
if (!delegateType.IsSubclassOf(typeof(Delegate)))
{
throw new ArgumentException("delegateType");
}
MethodInfo invokeMethod = delegateType.GetInvokeMethod();
if (invokeMethod == null)
{
throw new ArgumentException("delegate must contain an Invoke method", "delegateType");
}
ParameterInfo[] parameters2 = invokeMethod.GetParameters();
if (parameters2.Length != parameters.Count)
{
throw new ArgumentException(string.Format("Different number of arguments in delegate {0}", delegateType), "delegateType");
}
for (int i = 0; i < parameters2.Length; i++)
{
ParameterExpression parameterExpression = parameters[i];
if (parameterExpression == null)
{
throw new ArgumentNullException("parameters");
}
if (!Expression.CanAssign(parameterExpression.Type, parameters2[i].ParameterType))
{
throw new ArgumentException(string.Format("Can not assign a {0} to a {1}", parameters2[i].ParameterType, parameterExpression.Type));
}
}
if (invokeMethod.ReturnType == typeof(void) || Expression.CanAssign(invokeMethod.ReturnType, body.Type))
{
return body;
}
if (invokeMethod.ReturnType.IsExpression())
{
return Expression.Quote(body);
}
throw new ArgumentException(string.Format("body type {0} can not be assigned to {1}", body.Type, invokeMethod.ReturnType));
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.Expression`1" /> where the delegate type is known at compile time.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression`1" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
/// <typeparam name="TDelegate">A delegate type.</typeparam>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="TDelegate" /> is not a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of <paramref name="TDelegate" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for <paramref name="TDelegate" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of <paramref name="TDelegate" />.</exception>
// Token: 0x0600007F RID: 127 RVA: 0x00004410 File Offset: 0x00002610
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, params ParameterExpression[] parameters)
{
return Expression.Lambda<TDelegate>(body, parameters);
}
/// <summary>Creates an <see cref="T:System.Linq.Expressions.Expression`1" /> where the delegate type is known at compile time.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression`1" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
/// <param name="parameters">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
/// <typeparam name="TDelegate">A delegate type.</typeparam>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="TDelegate" /> is not a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of <paramref name="TDelegate" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for <paramref name="TDelegate" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of <paramref name="TDelegate" />.</exception>
// Token: 0x06000080 RID: 128 RVA: 0x0000441C File Offset: 0x0000261C
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, IEnumerable<ParameterExpression> parameters)
{
if (body == null)
{
throw new ArgumentNullException("body");
}
ReadOnlyCollection<ParameterExpression> readOnlyCollection = parameters.ToReadOnlyCollection<ParameterExpression>();
body = Expression.CheckLambda(typeof(TDelegate), body, readOnlyCollection);
return new Expression<TDelegate>(body, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> by first constructing a delegate type.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="body" /> is null.-or-One or more elements of <paramref name="parameters" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="parameters" /> contains more than four elements.</exception>
// Token: 0x06000081 RID: 129 RVA: 0x0000445C File Offset: 0x0000265C
public static LambdaExpression Lambda(Expression body, params ParameterExpression[] parameters)
{
if (body == null)
{
throw new ArgumentNullException("body");
}
if (parameters.Length > 4)
{
throw new ArgumentException("Too many parameters");
}
return Expression.Lambda(Expression.GetDelegateType(body.Type, parameters), body, parameters);
}
// Token: 0x06000082 RID: 130 RVA: 0x000044A4 File Offset: 0x000026A4
private static Type GetDelegateType(Type return_type, ParameterExpression[] parameters)
{
if (parameters == null)
{
parameters = new ParameterExpression[0];
}
if (return_type == typeof(void))
{
return Expression.GetActionType(parameters.Select((ParameterExpression p) => p.Type).ToArray<Type>());
}
Type[] array = new Type[parameters.Length + 1];
for (int i = 0; i < array.Length - 1; i++)
{
array[i] = parameters[i].Type;
}
array[array.Length - 1] = return_type;
return Expression.GetFuncType(array);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> and can be used when the delegate type is not known at compile time.</summary>
/// <returns>An object that represents a lambda expression which has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
/// <param name="delegateType">A <see cref="T:System.Type" /> that represents a delegate type.</param>
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="delegateType" /> or <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="delegateType" /> does not represent a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of the delegate type represented by <paramref name="delegateType" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for the delegate type represented by <paramref name="delegateType" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of the delegate type represented by <paramref name="delegateType" />.</exception>
// Token: 0x06000083 RID: 131 RVA: 0x00004538 File Offset: 0x00002738
public static LambdaExpression Lambda(Type delegateType, Expression body, params ParameterExpression[] parameters)
{
return Expression.Lambda(delegateType, body, parameters);
}
// Token: 0x06000084 RID: 132 RVA: 0x00004544 File Offset: 0x00002744
private static LambdaExpression CreateExpressionOf(Type type, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
{
return (LambdaExpression)typeof(Expression<>).MakeGenericType(new Type[] { type }).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, null, new Type[]
{
typeof(Expression),
typeof(ReadOnlyCollection<ParameterExpression>)
}, null).Invoke(new object[] { body, parameters });
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> and can be used when the delegate type is not known at compile time.</summary>
/// <returns>An object that represents a lambda expression which has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
/// <param name="delegateType">A <see cref="T:System.Type" /> that represents a delegate type.</param>
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
/// <param name="parameters">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="delegateType" /> or <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="delegateType" /> does not represent a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of the delegate type represented by <paramref name="delegateType" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for the delegate type represented by <paramref name="delegateType" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of the delegate type represented by <paramref name="delegateType" />.</exception>
// Token: 0x06000085 RID: 133 RVA: 0x000045AC File Offset: 0x000027AC
public static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
{
if (delegateType == null)
{
throw new ArgumentNullException("delegateType");
}
if (body == null)
{
throw new ArgumentNullException("body");
}
ReadOnlyCollection<ParameterExpression> readOnlyCollection = parameters.ToReadOnlyCollection<ParameterExpression>();
body = Expression.CheckLambda(delegateType, body, readOnlyCollection);
return Expression.CreateExpressionOf(delegateType, body, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> where the member is a field or property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> properties set to the specified values.</returns>
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="member" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Reflection.FieldInfo.FieldType" /> or <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the field or property that <paramref name="member" /> represents does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x06000086 RID: 134 RVA: 0x000045F4 File Offset: 0x000027F4
public static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers)
{
return Expression.ListBind(member, initializers);
}
// Token: 0x06000087 RID: 135 RVA: 0x00004600 File Offset: 0x00002800
private static void CheckIsAssignableToIEnumerable(Type t)
{
if (!t.IsAssignableTo(typeof(IEnumerable)))
{
throw new ArgumentException(string.Format("Type {0} doesn't implemen IEnumerable", t));
}
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> where the member is a field or property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> properties set to the specified values.</returns>
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="member" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Reflection.FieldInfo.FieldType" /> or <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the field or property that <paramref name="member" /> represents does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x06000088 RID: 136 RVA: 0x00004634 File Offset: 0x00002834
public static MemberListBinding ListBind(MemberInfo member, IEnumerable<ElementInit> initializers)
{
if (member == null)
{
throw new ArgumentNullException("member");
}
if (initializers == null)
{
throw new ArgumentNullException("initializers");
}
ReadOnlyCollection<ElementInit> readOnlyCollection = initializers.ToReadOnlyCollection<ElementInit>();
Expression.CheckForNull<ElementInit>(readOnlyCollection, "initializers");
member.OnFieldOrProperty(delegate(FieldInfo field)
{
Expression.CheckIsAssignableToIEnumerable(field.FieldType);
}, delegate(PropertyInfo prop)
{
Expression.CheckIsAssignableToIEnumerable(prop.PropertyType);
});
return new MemberListBinding(member, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> object based on a specified property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.MemberInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> populated with the elements of <paramref name="initializers" />.</returns>
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the property that the method represented by <paramref name="propertyAccessor" /> accesses does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x06000089 RID: 137 RVA: 0x000046BC File Offset: 0x000028BC
public static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers)
{
return Expression.ListBind(propertyAccessor, initializers);
}
// Token: 0x0600008A RID: 138 RVA: 0x000046C8 File Offset: 0x000028C8
private static void CheckForNull<T>(ReadOnlyCollection<T> collection, string name) where T : class
{
foreach (T t in collection)
{
if (t == null)
{
throw new ArgumentNullException(name);
}
}
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> based on a specified property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.MemberInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> populated with the elements of <paramref name="initializers" />.</returns>
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> is null. -or-One or more elements of <paramref name="initializers" /> are null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the property that the method represented by <paramref name="propertyAccessor" /> accesses does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x0600008B RID: 139 RVA: 0x00004734 File Offset: 0x00002934
public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
{
if (propertyAccessor == null)
{
throw new ArgumentNullException("propertyAccessor");
}
if (initializers == null)
{
throw new ArgumentNullException("initializers");
}
ReadOnlyCollection<ElementInit> readOnlyCollection = initializers.ToReadOnlyCollection<ElementInit>();
Expression.CheckForNull<ElementInit>(readOnlyCollection, "initializers");
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
if (associatedProperty == null)
{
throw new ArgumentException("propertyAccessor");
}
Expression.CheckIsAssignableToIEnumerable(associatedProperty.PropertyType);
return new MemberListBinding(associatedProperty, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses specified <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> properties set to the specified values.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x0600008C RID: 140 RVA: 0x000047A0 File Offset: 0x000029A0
public static ListInitExpression ListInit(NewExpression newExpression, params ElementInit[] initializers)
{
return Expression.ListInit(newExpression, initializers);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses specified <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> properties set to the specified values.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
// Token: 0x0600008D RID: 141 RVA: 0x000047AC File Offset: 0x000029AC
public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable<ElementInit> initializers)
{
ReadOnlyCollection<ElementInit> readOnlyCollection = Expression.CheckListInit<ElementInit>(newExpression, initializers);
return new ListInitExpression(newExpression, readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a method named "Add" to add elements to a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
/// <exception cref="T:System.InvalidOperationException">There is no instance method named "Add" (case insensitive) declared in <paramref name="newExpression" />.Type or its base type.-or-The add method on <paramref name="newExpression" />.Type or its base type does not take exactly one argument.-or-The type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of the first element of <paramref name="initializers" /> is not assignable to the argument type of the add method on <paramref name="newExpression" />.Type or its base type.-or-More than one argument-compatible method named "Add" (case-insensitive) exists on <paramref name="newExpression" />.Type and/or its base type.</exception>
// Token: 0x0600008E RID: 142 RVA: 0x000047C8 File Offset: 0x000029C8
public static ListInitExpression ListInit(NewExpression newExpression, params Expression[] initializers)
{
return Expression.ListInit(newExpression, initializers);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a method named "Add" to add elements to a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
/// <exception cref="T:System.InvalidOperationException">There is no instance method named "Add" (case insensitive) declared in <paramref name="newExpression" />.Type or its base type.-or-The add method on <paramref name="newExpression" />.Type or its base type does not take exactly one argument.-or-The type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of the first element of <paramref name="initializers" /> is not assignable to the argument type of the add method on <paramref name="newExpression" />.Type or its base type.-or-More than one argument-compatible method named "Add" (case-insensitive) exists on <paramref name="newExpression" />.Type and/or its base type.</exception>
// Token: 0x0600008F RID: 143 RVA: 0x000047D4 File Offset: 0x000029D4
public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable<Expression> initializers)
{
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckListInit<Expression>(newExpression, initializers);
MethodInfo addMethod = Expression.GetAddMethod(newExpression.Type, readOnlyCollection[0].Type);
if (addMethod == null)
{
throw new InvalidOperationException("No suitable add method found");
}
return new ListInitExpression(newExpression, Expression.CreateInitializers(addMethod, readOnlyCollection));
}
// Token: 0x06000090 RID: 144 RVA: 0x00004820 File Offset: 0x00002A20
private static ReadOnlyCollection<ElementInit> CreateInitializers(MethodInfo add_method, ReadOnlyCollection<Expression> initializers)
{
return initializers.Select((Expression init) => Expression.ElementInit(add_method, new Expression[] { init })).ToReadOnlyCollection<ElementInit>();
}
// Token: 0x06000091 RID: 145 RVA: 0x00004854 File Offset: 0x00002A54
private static MethodInfo GetAddMethod(Type type, Type arg)
{
return type.GetMethod("Add", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { arg }, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a specified method to add elements to a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method that takes one argument, that adds an element to a collection.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.-or-<paramref name="addMethod" /> is not null and it does not represent an instance method named "Add" (case insensitive) that takes exactly one argument.-or-<paramref name="addMethod" /> is not null and the type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="initializers" /> is not assignable to the argument type of the method that <paramref name="addMethod" /> represents.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="addMethod" /> is null and no instance method named "Add" that takes one type-compatible argument exists on <paramref name="newExpression" />.Type or its base type.</exception>
// Token: 0x06000092 RID: 146 RVA: 0x00004870 File Offset: 0x00002A70
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, params Expression[] initializers)
{
return Expression.ListInit(newExpression, addMethod, initializers);
}
// Token: 0x06000093 RID: 147 RVA: 0x0000487C File Offset: 0x00002A7C
private static ReadOnlyCollection<T> CheckListInit<T>(NewExpression newExpression, IEnumerable<T> initializers) where T : class
{
if (newExpression == null)
{
throw new ArgumentNullException("newExpression");
}
if (initializers == null)
{
throw new ArgumentNullException("initializers");
}
if (!newExpression.Type.IsAssignableTo(typeof(IEnumerable)))
{
throw new InvalidOperationException("The type of the new expression does not implement IEnumerable");
}
ReadOnlyCollection<T> readOnlyCollection = initializers.ToReadOnlyCollection<T>();
if (readOnlyCollection.Count == 0)
{
throw new ArgumentException("Empty initializers");
}
Expression.CheckForNull<T>(readOnlyCollection, "initializers");
return readOnlyCollection;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a specified method to add elements to a collection.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method named "Add" (case insensitive), that adds an element to a collection.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.-or-<paramref name="addMethod" /> is not null and it does not represent an instance method named "Add" (case insensitive) that takes exactly one argument.-or-<paramref name="addMethod" /> is not null and the type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="initializers" /> is not assignable to the argument type of the method that <paramref name="addMethod" /> represents.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="addMethod" /> is null and no instance method named "Add" that takes one type-compatible argument exists on <paramref name="newExpression" />.Type or its base type.</exception>
// Token: 0x06000094 RID: 148 RVA: 0x000048FC File Offset: 0x00002AFC
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
{
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckListInit<Expression>(newExpression, initializers);
if (addMethod != null)
{
if (addMethod.Name.ToLower(CultureInfo.InvariantCulture) != "add")
{
throw new ArgumentException("addMethod");
}
ParameterInfo[] parameters = addMethod.GetParameters();
if (parameters.Length != 1)
{
throw new ArgumentException("addMethod");
}
foreach (Expression expression in readOnlyCollection)
{
if (!Expression.IsAssignableToParameterType(expression.Type, parameters[0]))
{
throw new InvalidOperationException("Initializer not assignable to the add method parameter type");
}
}
}
if (addMethod == null)
{
addMethod = Expression.GetAddMethod(newExpression.Type, readOnlyCollection[0].Type);
}
if (addMethod == null)
{
throw new InvalidOperationException("No suitable add method found");
}
return new ListInitExpression(newExpression, Expression.CreateInitializers(addMethod, readOnlyCollection));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing either a field or a property.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.MemberExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the object that the member belongs to.</param>
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> that describes the field or property to be accessed.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="member" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.</exception>
// Token: 0x06000095 RID: 149 RVA: 0x00004A04 File Offset: 0x00002C04
public static MemberExpression MakeMemberAccess(Expression expression, MemberInfo member)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (member == null)
{
throw new ArgumentNullException("member");
}
FieldInfo fieldInfo = member as FieldInfo;
if (fieldInfo != null)
{
return Expression.Field(expression, fieldInfo);
}
PropertyInfo propertyInfo = member as PropertyInfo;
if (propertyInfo != null)
{
return Expression.Property(expression, propertyInfo);
}
throw new ArgumentException("Member should either be a field or a property");
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" />, given an operand, by calling the appropriate factory method.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.UnaryExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="unaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of unary operation.</param>
/// <param name="operand">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand.</param>
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type to be converted to (pass null if not applicable).</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="unaryType" /> does not correspond to a unary expression node.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="operand" /> is null.</exception>
// Token: 0x06000096 RID: 150 RVA: 0x00004A68 File Offset: 0x00002C68
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type)
{
return Expression.MakeUnary(unaryType, operand, type, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" />, given an operand and implementing method, by calling the appropriate factory method.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.UnaryExpression" /> that results from calling the appropriate factory method.</returns>
/// <param name="unaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of unary operation.</param>
/// <param name="operand">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand.</param>
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type to be converted to (pass null if not applicable).</param>
/// <param name="method">The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="unaryType" /> does not correspond to a unary expression node.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="operand" /> is null.</exception>
// Token: 0x06000097 RID: 151 RVA: 0x00004A74 File Offset: 0x00002C74
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
{
switch (unaryType)
{
case ExpressionType.Negate:
return Expression.Negate(operand, method);
case ExpressionType.UnaryPlus:
return Expression.UnaryPlus(operand, method);
case ExpressionType.NegateChecked:
return Expression.NegateChecked(operand, method);
default:
if (unaryType == ExpressionType.Convert)
{
return Expression.Convert(operand, type, method);
}
if (unaryType == ExpressionType.ConvertChecked)
{
return Expression.ConvertChecked(operand, type, method);
}
if (unaryType == ExpressionType.ArrayLength)
{
return Expression.ArrayLength(operand);
}
if (unaryType == ExpressionType.Quote)
{
return Expression.Quote(operand);
}
if (unaryType != ExpressionType.TypeAs)
{
throw new ArgumentException("MakeUnary expect an unary operator");
}
return Expression.TypeAs(operand, type);
case ExpressionType.Not:
return Expression.Not(operand, method);
}
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a field or property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="member" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the field or property that <paramref name="member" /> represents.</exception>
// Token: 0x06000098 RID: 152 RVA: 0x00004B28 File Offset: 0x00002D28
public static MemberMemberBinding MemberBind(MemberInfo member, params MemberBinding[] bindings)
{
return Expression.MemberBind(member, bindings);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a field or property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="member" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the field or property that <paramref name="member" /> represents.</exception>
// Token: 0x06000099 RID: 153 RVA: 0x00004B34 File Offset: 0x00002D34
public static MemberMemberBinding MemberBind(MemberInfo member, IEnumerable<MemberBinding> bindings)
{
if (member == null)
{
throw new ArgumentNullException("member");
}
Type type = member.OnFieldOrProperty((FieldInfo field) => field.FieldType, (PropertyInfo prop) => prop.PropertyType);
return new MemberMemberBinding(member, Expression.CheckMemberBindings(type, bindings));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a member that is accessed by using a property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the property accessed by the method that <paramref name="propertyAccessor" /> represents.</exception>
// Token: 0x0600009A RID: 154 RVA: 0x00004BA0 File Offset: 0x00002DA0
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, params MemberBinding[] bindings)
{
return Expression.MemberBind(propertyAccessor, bindings);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a member that is accessed by using a property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the property accessed by the method that <paramref name="propertyAccessor" /> represents.</exception>
// Token: 0x0600009B RID: 155 RVA: 0x00004BAC File Offset: 0x00002DAC
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, IEnumerable<MemberBinding> bindings)
{
if (propertyAccessor == null)
{
throw new ArgumentNullException("propertyAccessor");
}
ReadOnlyCollection<MemberBinding> readOnlyCollection = bindings.ToReadOnlyCollection<MemberBinding>();
Expression.CheckForNull<MemberBinding>(readOnlyCollection, "bindings");
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
if (associatedProperty == null)
{
throw new ArgumentException("propertyAccessor");
}
return new MemberMemberBinding(associatedProperty, Expression.CheckMemberBindings(associatedProperty.PropertyType, bindings));
}
// Token: 0x0600009C RID: 156 RVA: 0x00004C08 File Offset: 0x00002E08
private static ReadOnlyCollection<MemberBinding> CheckMemberBindings(Type type, IEnumerable<MemberBinding> bindings)
{
if (bindings == null)
{
throw new ArgumentNullException("bindings");
}
ReadOnlyCollection<MemberBinding> readOnlyCollection = bindings.ToReadOnlyCollection<MemberBinding>();
Expression.CheckForNull<MemberBinding>(readOnlyCollection, "bindings");
foreach (MemberBinding memberBinding in readOnlyCollection)
{
if (!type.IsAssignableTo(memberBinding.Member.DeclaringType))
{
throw new ArgumentException("Type not assignable to member type");
}
}
return readOnlyCollection;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberInitExpression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberInit" /> and the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> properties set to the specified values.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> property equal to.</param>
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type that <paramref name="newExpression" />.Type represents.</exception>
// Token: 0x0600009D RID: 157 RVA: 0x00004CA4 File Offset: 0x00002EA4
public static MemberInitExpression MemberInit(NewExpression newExpression, params MemberBinding[] bindings)
{
return Expression.MemberInit(newExpression, bindings);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberInitExpression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberInit" /> and the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> properties set to the specified values.</returns>
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> property equal to.</param>
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="newExpression" /> or <paramref name="bindings" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type that <paramref name="newExpression" />.Type represents.</exception>
// Token: 0x0600009E RID: 158 RVA: 0x00004CB0 File Offset: 0x00002EB0
public static MemberInitExpression MemberInit(NewExpression newExpression, IEnumerable<MemberBinding> bindings)
{
if (newExpression == null)
{
throw new ArgumentNullException("newExpression");
}
return new MemberInitExpression(newExpression, Expression.CheckMemberBindings(newExpression.Type, bindings));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Negate" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The unary minus operator is not defined for <paramref name="expression" />.Type.</exception>
// Token: 0x0600009F RID: 159 RVA: 0x00004CD8 File Offset: 0x00002ED8
public static UnaryExpression Negate(Expression expression)
{
return Expression.Negate(expression, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Negate" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the unary minus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
// Token: 0x060000A0 RID: 160 RVA: 0x00004CE4 File Offset: 0x00002EE4
public static UnaryExpression Negate(Expression expression, MethodInfo method)
{
method = Expression.UnaryCoreCheck("op_UnaryNegation", expression, method, (Type type) => Expression.IsSignedNumber(type));
return Expression.MakeSimpleUnary(ExpressionType.Negate, expression, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation that has overflow checking.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NegateChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The unary minus operator is not defined for <paramref name="expression" />.Type.</exception>
// Token: 0x060000A1 RID: 161 RVA: 0x00004D28 File Offset: 0x00002F28
public static UnaryExpression NegateChecked(Expression expression)
{
return Expression.NegateChecked(expression, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation that has overflow checking. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NegateChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the unary minus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
// Token: 0x060000A2 RID: 162 RVA: 0x00004D34 File Offset: 0x00002F34
public static UnaryExpression NegateChecked(Expression expression, MethodInfo method)
{
method = Expression.UnaryCoreCheck("op_UnaryNegation", expression, method, (Type type) => Expression.IsSignedNumber(type));
return Expression.MakeSimpleUnary(ExpressionType.NegateChecked, expression, method);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor that takes no arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property set to the specified value.</returns>
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="constructor" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The constructor that <paramref name="constructor" /> represents has at least one parameter.</exception>
// Token: 0x060000A3 RID: 163 RVA: 0x00004D78 File Offset: 0x00002F78
public static NewExpression New(ConstructorInfo constructor)
{
if (constructor == null)
{
throw new ArgumentNullException("constructor");
}
if (constructor.GetParameters().Length > 0)
{
throw new ArgumentException("Constructor must be parameter less");
}
return new NewExpression(constructor, Enumerable.ToReadOnlyCollection((IEnumerable<TSource>)null), null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the parameterless constructor of the specified type.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property set to the <see cref="T:System.Reflection.ConstructorInfo" /> that represents the parameterless constructor of the specified type.</returns>
/// <param name="type">A <see cref="T:System.Type" /> that has a constructor that takes no arguments.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The type that <paramref name="type" /> represents does not have a parameterless constructor.</exception>
// Token: 0x060000A4 RID: 164 RVA: 0x00004DB4 File Offset: 0x00002FB4
public static NewExpression New(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
Expression.CheckNotVoid(type);
ReadOnlyCollection<Expression> readOnlyCollection = Enumerable.ToReadOnlyCollection((IEnumerable<TSource>)null);
if (type.IsValueType)
{
return new NewExpression(type, readOnlyCollection);
}
ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
if (constructor == null)
{
throw new ArgumentException("Type doesn't have a parameter less constructor");
}
return new NewExpression(constructor, readOnlyCollection, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> and <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="arguments" /> does match the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.</exception>
// Token: 0x060000A5 RID: 165 RVA: 0x00004E18 File Offset: 0x00003018
public static NewExpression New(ConstructorInfo constructor, params Expression[] arguments)
{
return Expression.New(constructor, arguments);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> and <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> properties set to the specified values.</returns>
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.</exception>
// Token: 0x060000A6 RID: 166 RVA: 0x00004E24 File Offset: 0x00003024
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments)
{
if (constructor == null)
{
throw new ArgumentNullException("constructor");
}
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(constructor, arguments);
return new NewExpression(constructor, readOnlyCollection, null);
}
// Token: 0x060000A7 RID: 167 RVA: 0x00004E54 File Offset: 0x00003054
private static IList<Expression> CreateArgumentList(IEnumerable<Expression> arguments)
{
if (arguments == null)
{
return arguments.ToReadOnlyCollection<Expression>();
}
return arguments.ToList<Expression>();
}
// Token: 0x060000A8 RID: 168 RVA: 0x00004E6C File Offset: 0x0000306C
private static void CheckNonGenericMethod(MethodBase method)
{
if (method.IsGenericMethodDefinition || method.ContainsGenericParameters)
{
throw new ArgumentException("Can not used open generic methods");
}
}
// Token: 0x060000A9 RID: 169 RVA: 0x00004E90 File Offset: 0x00003090
private static ReadOnlyCollection<Expression> CheckMethodArguments(MethodBase method, IEnumerable<Expression> args)
{
Expression.CheckNonGenericMethod(method);
IList<Expression> list = Expression.CreateArgumentList(args);
ParameterInfo[] parameters = method.GetParameters();
if (list.Count != parameters.Length)
{
throw new ArgumentException("The number of arguments doesn't match the number of parameters");
}
for (int i = 0; i < parameters.Length; i++)
{
if (list[i] == null)
{
throw new ArgumentNullException("arguments");
}
if (!Expression.IsAssignableToParameterType(list[i].Type, parameters[i]))
{
if (!parameters[i].ParameterType.IsExpression())
{
throw new ArgumentException("arguments");
}
list[i] = Expression.Quote(list[i]);
}
}
return list.ToReadOnlyCollection<Expression>();
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified as an array.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" />, <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> and <see cref="P:System.Linq.Expressions.NewExpression.Members" /> properties set to the specified values.</returns>
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
/// <param name="members">An array of <see cref="T:System.Reflection.MemberInfo" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Members" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.-or-An element of <paramref name="members" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.-or-The <paramref name="members" /> parameter does not have the same number of elements as <paramref name="arguments" />.-or-An element of <paramref name="arguments" /> has a <see cref="P:System.Linq.Expressions.Expression.Type" /> property that represents a type that is not assignable to the type of the member that is represented by the corresponding element of <paramref name="members" />.-or-An element of <paramref name="members" /> represents a property that does not have a get accessor.</exception>
// Token: 0x060000AA RID: 170 RVA: 0x00004F44 File Offset: 0x00003144
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo[] members)
{
return Expression.New(constructor, arguments, members);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" />, <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> and <see cref="P:System.Linq.Expressions.NewExpression.Members" /> properties set to the specified values.</returns>
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
/// <param name="members">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Reflection.MemberInfo" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Members" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.-or-An element of <paramref name="members" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.-or-The <paramref name="members" /> parameter does not have the same number of elements as <paramref name="arguments" />.-or-An element of <paramref name="arguments" /> has a <see cref="P:System.Linq.Expressions.Expression.Type" /> property that represents a type that is not assignable to the type of the member that is represented by the corresponding element of <paramref name="members" />.-or-An element of members represents a property that does not have a get accessor.</exception>
// Token: 0x060000AB RID: 171 RVA: 0x00004F50 File Offset: 0x00003150
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
{
if (constructor == null)
{
throw new ArgumentNullException("constructor");
}
ReadOnlyCollection<Expression> readOnlyCollection = arguments.ToReadOnlyCollection<Expression>();
ReadOnlyCollection<MemberInfo> readOnlyCollection2 = members.ToReadOnlyCollection<MemberInfo>();
Expression.CheckForNull<Expression>(readOnlyCollection, "arguments");
Expression.CheckForNull<MemberInfo>(readOnlyCollection2, "members");
readOnlyCollection = Expression.CheckMethodArguments(constructor, arguments);
if (readOnlyCollection.Count != readOnlyCollection2.Count)
{
throw new ArgumentException("Arguments count does not match members count");
}
for (int i = 0; i < readOnlyCollection2.Count; i++)
{
MemberInfo memberInfo = readOnlyCollection2[i];
MemberTypes memberType = memberInfo.MemberType;
Type type;
if (memberType != MemberTypes.Field)
{
if (memberType != MemberTypes.Method)
{
if (memberType != MemberTypes.Property)
{
throw new ArgumentException("Member type not allowed");
}
PropertyInfo propertyInfo = memberInfo as PropertyInfo;
if (propertyInfo.GetGetMethod(true) == null)
{
throw new ArgumentException("Property must have a getter");
}
type = (memberInfo as PropertyInfo).PropertyType;
}
else
{
type = (memberInfo as MethodInfo).ReturnType;
}
}
else
{
type = (memberInfo as FieldInfo).FieldType;
}
if (!readOnlyCollection[i].Type.IsAssignableTo(type))
{
throw new ArgumentException("Argument type not assignable to member type");
}
}
return new NewExpression(constructor, readOnlyCollection, readOnlyCollection2);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating an array that has a specified rank.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
/// <param name="bounds">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="bounds" /> is null.-or-An element of <paramref name="bounds" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="bounds" /> does not represent an integral type.</exception>
// Token: 0x060000AC RID: 172 RVA: 0x0000508C File Offset: 0x0000328C
public static NewArrayExpression NewArrayBounds(Type type, params Expression[] bounds)
{
return Expression.NewArrayBounds(type, bounds);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating an array that has a specified rank.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
/// <param name="bounds">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="bounds" /> is null.-or-An element of <paramref name="bounds" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="bounds" /> does not represent an integral type.</exception>
// Token: 0x060000AD RID: 173 RVA: 0x00005098 File Offset: 0x00003298
public static NewArrayExpression NewArrayBounds(Type type, IEnumerable<Expression> bounds)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (bounds == null)
{
throw new ArgumentNullException("bounds");
}
Expression.CheckNotVoid(type);
ReadOnlyCollection<Expression> readOnlyCollection = bounds.ToReadOnlyCollection<Expression>();
foreach (Expression expression in readOnlyCollection)
{
if (!Expression.IsInt(expression.Type))
{
throw new ArgumentException("The bounds collection can only contain expression of integers types");
}
}
return new NewArrayExpression(ExpressionType.NewArrayBounds, type.MakeArrayType(readOnlyCollection.Count), readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating a one-dimensional array and initializing it from a list of elements.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="initializers" /> is null.-or-An element of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="initializers" /> represents a type that is not assignable to the type <paramref name="type" />.</exception>
// Token: 0x060000AE RID: 174 RVA: 0x00005150 File Offset: 0x00003350
public static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers)
{
return Expression.NewArrayInit(type, initializers);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating a one-dimensional array and initializing it from a list of elements.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> or <paramref name="initializers" /> is null.-or-An element of <paramref name="initializers" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="initializers" /> represents a type that is not assignable to the type that <paramref name="type" /> represents.</exception>
// Token: 0x060000AF RID: 175 RVA: 0x0000515C File Offset: 0x0000335C
public static NewArrayExpression NewArrayInit(Type type, IEnumerable<Expression> initializers)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (initializers == null)
{
throw new ArgumentNullException("initializers");
}
Expression.CheckNotVoid(type);
ReadOnlyCollection<Expression> readOnlyCollection = initializers.ToReadOnlyCollection<Expression>();
foreach (Expression expression in readOnlyCollection)
{
if (expression == null)
{
throw new ArgumentNullException("initializers");
}
if (!expression.Type.IsAssignableTo(type))
{
throw new InvalidOperationException(string.Format("{0} IsAssignableTo {1}, expression [ {2} ] : {3}", new object[] { expression.Type, type, expression.NodeType, expression }));
}
}
return new NewArrayExpression(ExpressionType.NewArrayInit, type.MakeArrayType(), readOnlyCollection);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a bitwise complement operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Not" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The unary not operator is not defined for <paramref name="expression" />.Type.</exception>
// Token: 0x060000B0 RID: 176 RVA: 0x00005248 File Offset: 0x00003448
public static UnaryExpression Not(Expression expression)
{
return Expression.Not(expression, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a bitwise complement operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Not" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the unary not operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
// Token: 0x060000B1 RID: 177 RVA: 0x00005254 File Offset: 0x00003454
public static UnaryExpression Not(Expression expression, MethodInfo method)
{
Func<Type, bool> func = (Type type) => Expression.IsIntOrBool(type);
method = Expression.UnaryCoreCheck("op_LogicalNot", expression, method, func);
if (method == null)
{
method = Expression.UnaryCoreCheck("op_OnesComplement", expression, method, func);
}
return Expression.MakeSimpleUnary(ExpressionType.Not, expression, method);
}
// Token: 0x060000B2 RID: 178 RVA: 0x000052AC File Offset: 0x000034AC
private static void CheckNotVoid(Type type)
{
if (type == typeof(void))
{
throw new ArgumentException("Type can't be void");
}
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ParameterExpression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.ParameterExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Parameter" /> and the <see cref="P:System.Linq.Expressions.Expression.Type" /> and <see cref="P:System.Linq.Expressions.ParameterExpression.Name" /> properties set to the specified values.</returns>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <param name="name">The value to set the <see cref="P:System.Linq.Expressions.ParameterExpression.Name" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type" /> is null.</exception>
// Token: 0x060000B3 RID: 179 RVA: 0x000052CC File Offset: 0x000034CC
public static ParameterExpression Parameter(Type type, string name)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
Expression.CheckNotVoid(type);
return new ParameterExpression(type, name);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property by using a property accessor method.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="propertyAccessor" /> is null.-or-The method that <paramref name="propertyAccessor" /> represents is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="expression" />.Type is not assignable to the declaring type of the method represented by <paramref name="propertyAccessor" />.-or-The method that <paramref name="propertyAccessor" /> represents is not a property accessor method.</exception>
// Token: 0x060000B4 RID: 180 RVA: 0x000052EC File Offset: 0x000034EC
public static MemberExpression Property(Expression expression, MethodInfo propertyAccessor)
{
if (propertyAccessor == null)
{
throw new ArgumentNullException("propertyAccessor");
}
Expression.CheckNonGenericMethod(propertyAccessor);
if (!propertyAccessor.IsStatic)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (!expression.Type.IsAssignableTo(propertyAccessor.DeclaringType))
{
throw new ArgumentException("expression");
}
}
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
if (associatedProperty == null)
{
throw new ArgumentException(string.Format("Method {0} has no associated property", propertyAccessor));
}
return new MemberExpression(expression, associatedProperty, associatedProperty.PropertyType);
}
// Token: 0x060000B5 RID: 181 RVA: 0x00005378 File Offset: 0x00003578
private static PropertyInfo GetAssociatedProperty(MethodInfo method)
{
if (method == null)
{
return null;
}
foreach (PropertyInfo propertyInfo in method.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy))
{
if (method.Equals(propertyInfo.GetGetMethod(true)))
{
return propertyInfo;
}
if (method.Equals(propertyInfo.GetSetMethod(true)))
{
return propertyInfo;
}
}
return null;
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> and <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
/// <param name="property">The <see cref="T:System.Reflection.PropertyInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="property" /> is null.-or-The property that <paramref name="property" /> represents is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="expression" />.Type is not assignable to the declaring type of the property that <paramref name="property" /> represents.</exception>
// Token: 0x060000B6 RID: 182 RVA: 0x000053DC File Offset: 0x000035DC
public static MemberExpression Property(Expression expression, PropertyInfo property)
{
if (property == null)
{
throw new ArgumentNullException("property");
}
MethodInfo getMethod = property.GetGetMethod(true);
if (getMethod == null)
{
throw new ArgumentException("getter");
}
if (!getMethod.IsStatic)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (!expression.Type.IsAssignableTo(property.DeclaringType))
{
throw new ArgumentException("expression");
}
}
else if (expression != null)
{
throw new ArgumentException("expression");
}
return new MemberExpression(expression, property, property.PropertyType);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property given the name of the property.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property denoted by <paramref name="propertyName" />.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a property named <paramref name="propertyName" />.</param>
/// <param name="propertyName">The name of a property.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="propertyName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">No property named <paramref name="propertyName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
// Token: 0x060000B7 RID: 183 RVA: 0x00005474 File Offset: 0x00003674
public static MemberExpression Property(Expression expression, string propertyName)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
PropertyInfo property = expression.Type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
if (property == null)
{
throw new ArgumentException(string.Format("No property named {0} on {1}", propertyName, expression.Type));
}
return new MemberExpression(expression, property, property.PropertyType);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property or field given the name of the property or field.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> or <see cref="T:System.Reflection.FieldInfo" /> that represents the property or field denoted by <paramref name="propertyOrFieldName" />.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a property or field named <paramref name="propertyOrFieldName" />.</param>
/// <param name="propertyOrFieldName">The name of a property or field.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="propertyOrFieldName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">No property or field named <paramref name="propertyOrFieldName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
// Token: 0x060000B8 RID: 184 RVA: 0x000054CC File Offset: 0x000036CC
public static MemberExpression PropertyOrField(Expression expression, string propertyOrFieldName)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (propertyOrFieldName == null)
{
throw new ArgumentNullException("propertyOrFieldName");
}
PropertyInfo property = expression.Type.GetProperty(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
if (property != null)
{
return new MemberExpression(expression, property, property.PropertyType);
}
FieldInfo field = expression.Type.GetField(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
if (field != null)
{
return new MemberExpression(expression, field, field.FieldType);
}
throw new ArgumentException(string.Format("No field or property named {0} on {1}", propertyOrFieldName, expression.Type));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an expression that has a constant value of type <see cref="T:System.Linq.Expressions.Expression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Quote" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
// Token: 0x060000B9 RID: 185 RVA: 0x00005558 File Offset: 0x00003758
public static UnaryExpression Quote(Expression expression)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
return new UnaryExpression(ExpressionType.Quote, expression, expression.GetType());
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.TypeAs" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
// Token: 0x060000BA RID: 186 RVA: 0x0000557C File Offset: 0x0000377C
public static UnaryExpression TypeAs(Expression expression, Type type)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
if (type.IsValueType && !type.IsNullable())
{
throw new ArgumentException("TypeAs expect a reference or a nullable type");
}
return new UnaryExpression(ExpressionType.TypeAs, expression, type);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.TypeBinaryExpression" />.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.TypeBinaryExpression" /> for which the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is equal to <see cref="F:System.Linq.Expressions.ExpressionType.TypeIs" /> and for which the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.Expression" /> and <see cref="P:System.Linq.Expressions.TypeBinaryExpression.TypeOperand" /> properties are set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.Expression" /> property equal to.</param>
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.TypeOperand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
// Token: 0x060000BB RID: 187 RVA: 0x000055D8 File Offset: 0x000037D8
public static TypeBinaryExpression TypeIs(Expression expression, Type type)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
if (type == null)
{
throw new ArgumentNullException("type");
}
Expression.CheckNotVoid(type);
return new TypeBinaryExpression(ExpressionType.TypeIs, expression, type, typeof(bool));
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a unary plus operation.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.UnaryPlus" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.InvalidOperationException">The unary plus operator is not defined for <paramref name="expression" />.Type.</exception>
// Token: 0x060000BC RID: 188 RVA: 0x00005618 File Offset: 0x00003818
public static UnaryExpression UnaryPlus(Expression expression)
{
return Expression.UnaryPlus(expression, null);
}
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a unary plus operation. The implementing method can be specified.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.UnaryPlus" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="expression" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="method" /> is null and the unary plus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
// Token: 0x060000BD RID: 189 RVA: 0x00005624 File Offset: 0x00003824
public static UnaryExpression UnaryPlus(Expression expression, MethodInfo method)
{
method = Expression.UnaryCoreCheck("op_UnaryPlus", expression, method, (Type type) => Expression.IsNumber(type));
return Expression.MakeSimpleUnary(ExpressionType.UnaryPlus, expression, method);
}
// Token: 0x060000BE RID: 190 RVA: 0x00005668 File Offset: 0x00003868
private static bool IsInt(Type t)
{
return t == typeof(byte) || t == typeof(sbyte) || t == typeof(short) || t == typeof(ushort) || t == typeof(int) || t == typeof(uint) || t == typeof(long) || t == typeof(ulong);
}
// Token: 0x060000BF RID: 191 RVA: 0x000056F8 File Offset: 0x000038F8
private static bool IsIntOrBool(Type t)
{
return Expression.IsInt(t) || t == typeof(bool);
}
// Token: 0x060000C0 RID: 192 RVA: 0x00005718 File Offset: 0x00003918
private static bool IsNumber(Type t)
{
return Expression.IsInt(t) || t == typeof(float) || t == typeof(double);
}
// Token: 0x060000C1 RID: 193 RVA: 0x00005748 File Offset: 0x00003948
private static bool IsSignedNumber(Type t)
{
return Expression.IsNumber(t) && !Expression.IsUnsigned(t);
}
// Token: 0x060000C2 RID: 194 RVA: 0x00005764 File Offset: 0x00003964
internal static bool IsUnsigned(Type t)
{
if (t.IsPointer)
{
return Expression.IsUnsigned(t.GetElementType());
}
return t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t == typeof(byte);
}
// Token: 0x060000C3 RID: 195 RVA: 0x000057C8 File Offset: 0x000039C8
internal virtual void Emit(EmitContext ec)
{
throw new NotImplementedException(string.Format("Emit method is not implemented in expression type {0}", base.GetType()));
}
// Token: 0x04000003 RID: 3
internal const BindingFlags PublicInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy;
// Token: 0x04000004 RID: 4
internal const BindingFlags NonPublicInstance = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
// Token: 0x04000005 RID: 5
internal const BindingFlags PublicStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy;
// Token: 0x04000006 RID: 6
internal const BindingFlags AllInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
// Token: 0x04000007 RID: 7
internal const BindingFlags AllStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
// Token: 0x04000008 RID: 8
internal const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
// Token: 0x04000009 RID: 9
private ExpressionType node_type;
// Token: 0x0400000A RID: 10
private Type type;
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections.ObjectModel;
namespace System.Linq.Expressions
{
/// <summary>Represents a strongly typed lambda expression as a data structure in the form of an expression tree. This class cannot be inherited.</summary>
/// <typeparam name="TDelegate">The type of the delegate that the <see cref="T:System.Linq.Expressions.Expression`1" /> represents.</typeparam>
// Token: 0x02000003 RID: 3
public sealed class Expression<TDelegate> : LambdaExpression
{
// Token: 0x06000002 RID: 2 RVA: 0x000020F4 File Offset: 0x000002F4
internal Expression(Expression body, ReadOnlyCollection<ParameterExpression> parameters)
: base(typeof(TDelegate), body, parameters)
{
}
/// <summary>Compiles the lambda expression described by the expression tree into executable code.</summary>
/// <returns>A delegate of type <paramref name="TDelegate" /> that represents the lambda expression described by the <see cref="T:System.Linq.Expressions.Expression`1" />.</returns>
// Token: 0x06000003 RID: 3 RVA: 0x00002108 File Offset: 0x00000308
public new TDelegate Compile()
{
return (TDelegate)((object)base.Compile());
}
}
}
@@ -0,0 +1,424 @@
using System;
using System.Collections.ObjectModel;
using System.Text;
namespace System.Linq.Expressions
{
// Token: 0x0200001D RID: 29
internal class ExpressionPrinter : ExpressionVisitor
{
// Token: 0x060001AC RID: 428 RVA: 0x00009E64 File Offset: 0x00008064
private ExpressionPrinter(StringBuilder builder)
{
this.builder = builder;
}
// Token: 0x060001AD RID: 429 RVA: 0x00009E74 File Offset: 0x00008074
private ExpressionPrinter()
: this(new StringBuilder())
{
}
// Token: 0x060001AE RID: 430 RVA: 0x00009E84 File Offset: 0x00008084
public static string ToString(Expression expression)
{
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
expressionPrinter.Visit(expression);
return expressionPrinter.builder.ToString();
}
// Token: 0x060001AF RID: 431 RVA: 0x00009EAC File Offset: 0x000080AC
public static string ToString(ElementInit init)
{
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
expressionPrinter.VisitElementInitializer(init);
return expressionPrinter.builder.ToString();
}
// Token: 0x060001B0 RID: 432 RVA: 0x00009ED4 File Offset: 0x000080D4
public static string ToString(MemberBinding binding)
{
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
expressionPrinter.VisitBinding(binding);
return expressionPrinter.builder.ToString();
}
// Token: 0x060001B1 RID: 433 RVA: 0x00009EFC File Offset: 0x000080FC
private void Print(string str)
{
this.builder.Append(str);
}
// Token: 0x060001B2 RID: 434 RVA: 0x00009F0C File Offset: 0x0000810C
private void Print(object obj)
{
this.builder.Append(obj);
}
// Token: 0x060001B3 RID: 435 RVA: 0x00009F1C File Offset: 0x0000811C
private void Print(string str, params object[] objs)
{
this.builder.AppendFormat(str, objs);
}
// Token: 0x060001B4 RID: 436 RVA: 0x00009F2C File Offset: 0x0000812C
protected override void VisitElementInitializer(ElementInit initializer)
{
this.Print(initializer.AddMethod);
this.Print("(");
this.VisitExpressionList(initializer.Arguments);
this.Print(")");
}
// Token: 0x060001B5 RID: 437 RVA: 0x00009F68 File Offset: 0x00008168
protected override void VisitUnary(UnaryExpression unary)
{
ExpressionType nodeType = unary.NodeType;
if (nodeType != ExpressionType.Convert && nodeType != ExpressionType.ConvertChecked)
{
if (nodeType == ExpressionType.Negate)
{
this.Print("-");
this.Visit(unary.Operand);
return;
}
if (nodeType == ExpressionType.UnaryPlus)
{
this.Print("+");
this.Visit(unary.Operand);
return;
}
if (nodeType != ExpressionType.ArrayLength && nodeType != ExpressionType.Not)
{
if (nodeType == ExpressionType.Quote)
{
this.Visit(unary.Operand);
return;
}
if (nodeType != ExpressionType.TypeAs)
{
throw new NotImplementedException();
}
this.Print("(");
this.Visit(unary.Operand);
this.Print(" As {0})", new object[] { unary.Type.Name });
return;
}
}
this.Print("{0}(", new object[] { unary.NodeType });
this.Visit(unary.Operand);
this.Print(")");
}
// Token: 0x060001B6 RID: 438 RVA: 0x0000A070 File Offset: 0x00008270
private static string OperatorToString(BinaryExpression binary)
{
switch (binary.NodeType)
{
case ExpressionType.Add:
case ExpressionType.AddChecked:
return "+";
case ExpressionType.And:
return (!ExpressionPrinter.IsBoolean(binary)) ? "&" : "And";
case ExpressionType.AndAlso:
return "&&";
case ExpressionType.Coalesce:
return "??";
case ExpressionType.Divide:
return "/";
case ExpressionType.Equal:
return "=";
case ExpressionType.ExclusiveOr:
return "^";
case ExpressionType.GreaterThan:
return ">";
case ExpressionType.GreaterThanOrEqual:
return ">=";
case ExpressionType.LeftShift:
return "<<";
case ExpressionType.LessThan:
return "<";
case ExpressionType.LessThanOrEqual:
return "<=";
case ExpressionType.Modulo:
return "%";
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
return "*";
case ExpressionType.NotEqual:
return "!=";
case ExpressionType.Or:
return (!ExpressionPrinter.IsBoolean(binary)) ? "|" : "Or";
case ExpressionType.OrElse:
return "||";
case ExpressionType.Power:
return "^";
case ExpressionType.RightShift:
return ">>";
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
return "-";
}
return null;
}
// Token: 0x060001B7 RID: 439 RVA: 0x0000A1E4 File Offset: 0x000083E4
private static bool IsBoolean(Expression expression)
{
return expression.Type == typeof(bool) || expression.Type == typeof(bool?);
}
// Token: 0x060001B8 RID: 440 RVA: 0x0000A21C File Offset: 0x0000841C
private void PrintArrayIndex(BinaryExpression index)
{
this.Visit(index.Left);
this.Print("[");
this.Visit(index.Right);
this.Print("]");
}
// Token: 0x060001B9 RID: 441 RVA: 0x0000A258 File Offset: 0x00008458
protected override void VisitBinary(BinaryExpression binary)
{
ExpressionType nodeType = binary.NodeType;
if (nodeType != ExpressionType.ArrayIndex)
{
this.Print("(");
this.Visit(binary.Left);
this.Print(" {0} ", new object[] { ExpressionPrinter.OperatorToString(binary) });
this.Visit(binary.Right);
this.Print(")");
return;
}
this.PrintArrayIndex(binary);
}
// Token: 0x060001BA RID: 442 RVA: 0x0000A2C8 File Offset: 0x000084C8
protected override void VisitTypeIs(TypeBinaryExpression type)
{
ExpressionType nodeType = type.NodeType;
if (nodeType != ExpressionType.TypeIs)
{
throw new NotImplementedException();
}
this.Print("(");
this.Visit(type.Expression);
this.Print(" Is {0})", new object[] { type.TypeOperand.Name });
}
// Token: 0x060001BB RID: 443 RVA: 0x0000A328 File Offset: 0x00008528
protected override void VisitConstant(ConstantExpression constant)
{
object value = constant.Value;
if (value == null)
{
this.Print("null");
}
else if (value is string)
{
this.Print("\"");
this.Print(value);
this.Print("\"");
}
else if (!ExpressionPrinter.HasStringRepresentation(value))
{
this.Print("value(");
this.Print(value);
this.Print(")");
}
else
{
this.Print(value);
}
}
// Token: 0x060001BC RID: 444 RVA: 0x0000A3B4 File Offset: 0x000085B4
private static bool HasStringRepresentation(object obj)
{
return obj.ToString() != obj.GetType().ToString();
}
// Token: 0x060001BD RID: 445 RVA: 0x0000A3D8 File Offset: 0x000085D8
protected override void VisitConditional(ConditionalExpression conditional)
{
this.Print("IIF(");
this.Visit(conditional.Test);
this.Print(", ");
this.Visit(conditional.IfTrue);
this.Print(", ");
this.Visit(conditional.IfFalse);
this.Print(")");
}
// Token: 0x060001BE RID: 446 RVA: 0x0000A438 File Offset: 0x00008638
protected override void VisitParameter(ParameterExpression parameter)
{
this.Print(parameter.Name ?? "<param>");
}
// Token: 0x060001BF RID: 447 RVA: 0x0000A454 File Offset: 0x00008654
protected override void VisitMemberAccess(MemberExpression access)
{
if (access.Expression == null)
{
this.Print(access.Member.DeclaringType.Name);
}
else
{
this.Visit(access.Expression);
}
this.Print(".{0}", new object[] { access.Member.Name });
}
// Token: 0x060001C0 RID: 448 RVA: 0x0000A4B4 File Offset: 0x000086B4
protected override void VisitMethodCall(MethodCallExpression call)
{
if (call.Object != null)
{
this.Visit(call.Object);
this.Print(".");
}
this.Print(call.Method.Name);
this.Print("(");
this.VisitExpressionList(call.Arguments);
this.Print(")");
}
// Token: 0x060001C1 RID: 449 RVA: 0x0000A518 File Offset: 0x00008718
protected override void VisitMemberAssignment(MemberAssignment assignment)
{
this.Print("{0} = ", new object[] { assignment.Member.Name });
this.Visit(assignment.Expression);
}
// Token: 0x060001C2 RID: 450 RVA: 0x0000A550 File Offset: 0x00008750
protected override void VisitMemberMemberBinding(MemberMemberBinding binding)
{
this.Print(binding.Member.Name);
this.Print(" = {");
this.VisitList<MemberBinding>(binding.Bindings, new Action<MemberBinding>(this.VisitBinding));
this.Print("}");
}
// Token: 0x060001C3 RID: 451 RVA: 0x0000A5A0 File Offset: 0x000087A0
protected override void VisitMemberListBinding(MemberListBinding binding)
{
this.Print(binding.Member.Name);
this.Print(" = {");
this.VisitList<ElementInit>(binding.Initializers, new Action<ElementInit>(this.VisitElementInitializer));
this.Print("}");
}
// Token: 0x060001C4 RID: 452 RVA: 0x0000A5F0 File Offset: 0x000087F0
protected override void VisitList<T>(ReadOnlyCollection<T> list, Action<T> visitor)
{
for (int i = 0; i < list.Count; i++)
{
if (i > 0)
{
this.Print(", ");
}
visitor(list[i]);
}
}
// Token: 0x060001C5 RID: 453 RVA: 0x0000A634 File Offset: 0x00008834
protected override void VisitLambda(LambdaExpression lambda)
{
if (lambda.Parameters.Count != 1)
{
this.Print("(");
this.VisitList<ParameterExpression>(lambda.Parameters, new Action<ParameterExpression>(this.Visit));
this.Print(")");
}
else
{
this.Visit(lambda.Parameters[0]);
}
this.Print(" => ");
this.Visit(lambda.Body);
}
// Token: 0x060001C6 RID: 454 RVA: 0x0000A6B0 File Offset: 0x000088B0
protected override void VisitNew(NewExpression nex)
{
this.Print("new {0}(", new object[] { nex.Type.Name });
if (nex.Members != null && nex.Members.Count > 0)
{
for (int i = 0; i < nex.Members.Count; i++)
{
if (i > 0)
{
this.Print(", ");
}
this.Print("{0} = ", new object[] { nex.Members[i].Name });
this.Visit(nex.Arguments[i]);
}
}
else
{
this.VisitExpressionList(nex.Arguments);
}
this.Print(")");
}
// Token: 0x060001C7 RID: 455 RVA: 0x0000A77C File Offset: 0x0000897C
protected override void VisitMemberInit(MemberInitExpression init)
{
this.Visit(init.NewExpression);
this.Print(" {");
this.VisitList<MemberBinding>(init.Bindings, new Action<MemberBinding>(this.VisitBinding));
this.Print("}");
}
// Token: 0x060001C8 RID: 456 RVA: 0x0000A7C4 File Offset: 0x000089C4
protected override void VisitListInit(ListInitExpression init)
{
this.Visit(init.NewExpression);
this.Print(" {");
this.VisitList<ElementInit>(init.Initializers, new Action<ElementInit>(this.VisitElementInitializer));
this.Print("}");
}
// Token: 0x060001C9 RID: 457 RVA: 0x0000A80C File Offset: 0x00008A0C
protected override void VisitNewArray(NewArrayExpression newArray)
{
this.Print("new ");
ExpressionType nodeType = newArray.NodeType;
if (nodeType == ExpressionType.NewArrayInit)
{
this.Print("[] {");
this.VisitExpressionList(newArray.Expressions);
this.Print("}");
return;
}
if (nodeType != ExpressionType.NewArrayBounds)
{
throw new NotSupportedException();
}
this.Print(newArray.Type);
this.Print("(");
this.VisitExpressionList(newArray.Expressions);
this.Print(")");
}
// Token: 0x060001CA RID: 458 RVA: 0x0000A898 File Offset: 0x00008A98
protected override void VisitInvocation(InvocationExpression invocation)
{
this.Print("Invoke(");
this.Visit(invocation.Expression);
if (invocation.Arguments.Count != 0)
{
this.Print(", ");
this.VisitExpressionList(invocation.Arguments);
}
this.Print(")");
}
// Token: 0x04000074 RID: 116
private const string ListSeparator = ", ";
// Token: 0x04000075 RID: 117
private StringBuilder builder;
}
}
@@ -0,0 +1,368 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace System.Linq.Expressions
{
// Token: 0x0200001E RID: 30
internal abstract class ExpressionTransformer
{
// Token: 0x060001CC RID: 460 RVA: 0x0000A8F8 File Offset: 0x00008AF8
public Expression Transform(Expression expression)
{
return this.Visit(expression);
}
// Token: 0x060001CD RID: 461 RVA: 0x0000A904 File Offset: 0x00008B04
protected virtual Expression Visit(Expression exp)
{
if (exp == null)
{
return exp;
}
switch (exp.NodeType)
{
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.And:
case ExpressionType.AndAlso:
case ExpressionType.ArrayIndex:
case ExpressionType.Coalesce:
case ExpressionType.Divide:
case ExpressionType.Equal:
case ExpressionType.ExclusiveOr:
case ExpressionType.GreaterThan:
case ExpressionType.GreaterThanOrEqual:
case ExpressionType.LeftShift:
case ExpressionType.LessThan:
case ExpressionType.LessThanOrEqual:
case ExpressionType.Modulo:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
case ExpressionType.NotEqual:
case ExpressionType.Or:
case ExpressionType.OrElse:
case ExpressionType.Power:
case ExpressionType.RightShift:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
return this.VisitBinary((BinaryExpression)exp);
case ExpressionType.ArrayLength:
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
case ExpressionType.Negate:
case ExpressionType.UnaryPlus:
case ExpressionType.NegateChecked:
case ExpressionType.Not:
case ExpressionType.Quote:
case ExpressionType.TypeAs:
return this.VisitUnary((UnaryExpression)exp);
case ExpressionType.Call:
return this.VisitMethodCall((MethodCallExpression)exp);
case ExpressionType.Conditional:
return this.VisitConditional((ConditionalExpression)exp);
case ExpressionType.Constant:
return this.VisitConstant((ConstantExpression)exp);
case ExpressionType.Invoke:
return this.VisitInvocation((InvocationExpression)exp);
case ExpressionType.Lambda:
return this.VisitLambda((LambdaExpression)exp);
case ExpressionType.ListInit:
return this.VisitListInit((ListInitExpression)exp);
case ExpressionType.MemberAccess:
return this.VisitMemberAccess((MemberExpression)exp);
case ExpressionType.MemberInit:
return this.VisitMemberInit((MemberInitExpression)exp);
case ExpressionType.New:
return this.VisitNew((NewExpression)exp);
case ExpressionType.NewArrayInit:
case ExpressionType.NewArrayBounds:
return this.VisitNewArray((NewArrayExpression)exp);
case ExpressionType.Parameter:
return this.VisitParameter((ParameterExpression)exp);
case ExpressionType.TypeIs:
return this.VisitTypeIs((TypeBinaryExpression)exp);
default:
throw new Exception(string.Format("Unhandled expression type: '{0}'", exp.NodeType));
}
}
// Token: 0x060001CE RID: 462 RVA: 0x0000AAB4 File Offset: 0x00008CB4
protected virtual MemberBinding VisitBinding(MemberBinding binding)
{
switch (binding.BindingType)
{
case MemberBindingType.Assignment:
return this.VisitMemberAssignment((MemberAssignment)binding);
case MemberBindingType.MemberBinding:
return this.VisitMemberMemberBinding((MemberMemberBinding)binding);
case MemberBindingType.ListBinding:
return this.VisitMemberListBinding((MemberListBinding)binding);
default:
throw new Exception(string.Format("Unhandled binding type '{0}'", binding.BindingType));
}
}
// Token: 0x060001CF RID: 463 RVA: 0x0000AB20 File Offset: 0x00008D20
protected virtual ElementInit VisitElementInitializer(ElementInit initializer)
{
ReadOnlyCollection<Expression> readOnlyCollection = this.VisitExpressionList(initializer.Arguments);
if (readOnlyCollection != initializer.Arguments)
{
return Expression.ElementInit(initializer.AddMethod, readOnlyCollection);
}
return initializer;
}
// Token: 0x060001D0 RID: 464 RVA: 0x0000AB54 File Offset: 0x00008D54
protected virtual Expression VisitUnary(UnaryExpression u)
{
Expression expression = this.Visit(u.Operand);
if (expression != u.Operand)
{
return Expression.MakeUnary(u.NodeType, expression, u.Type, u.Method);
}
return u;
}
// Token: 0x060001D1 RID: 465 RVA: 0x0000AB94 File Offset: 0x00008D94
protected virtual Expression VisitBinary(BinaryExpression b)
{
Expression expression = this.Visit(b.Left);
Expression expression2 = this.Visit(b.Right);
Expression expression3 = this.Visit(b.Conversion);
if (expression == b.Left && expression2 == b.Right && expression3 == b.Conversion)
{
return b;
}
if (b.NodeType == ExpressionType.Coalesce && b.Conversion != null)
{
return Expression.Coalesce(expression, expression2, expression3 as LambdaExpression);
}
return Expression.MakeBinary(b.NodeType, expression, expression2, b.IsLiftedToNull, b.Method);
}
// Token: 0x060001D2 RID: 466 RVA: 0x0000AC2C File Offset: 0x00008E2C
protected virtual Expression VisitTypeIs(TypeBinaryExpression b)
{
Expression expression = this.Visit(b.Expression);
if (expression != b.Expression)
{
return Expression.TypeIs(expression, b.TypeOperand);
}
return b;
}
// Token: 0x060001D3 RID: 467 RVA: 0x0000AC60 File Offset: 0x00008E60
protected virtual Expression VisitConstant(ConstantExpression c)
{
return c;
}
// Token: 0x060001D4 RID: 468 RVA: 0x0000AC64 File Offset: 0x00008E64
protected virtual Expression VisitConditional(ConditionalExpression c)
{
Expression expression = this.Visit(c.Test);
Expression expression2 = this.Visit(c.IfTrue);
Expression expression3 = this.Visit(c.IfFalse);
if (expression != c.Test || expression2 != c.IfTrue || expression3 != c.IfFalse)
{
return Expression.Condition(expression, expression2, expression3);
}
return c;
}
// Token: 0x060001D5 RID: 469 RVA: 0x0000ACC8 File Offset: 0x00008EC8
protected virtual Expression VisitParameter(ParameterExpression p)
{
return p;
}
// Token: 0x060001D6 RID: 470 RVA: 0x0000ACCC File Offset: 0x00008ECC
protected virtual Expression VisitMemberAccess(MemberExpression m)
{
Expression expression = this.Visit(m.Expression);
if (expression != m.Expression)
{
return Expression.MakeMemberAccess(expression, m.Member);
}
return m;
}
// Token: 0x060001D7 RID: 471 RVA: 0x0000AD00 File Offset: 0x00008F00
protected virtual Expression VisitMethodCall(MethodCallExpression m)
{
Expression expression = this.Visit(m.Object);
IEnumerable<Expression> enumerable = this.VisitExpressionList(m.Arguments);
if (expression != m.Object || enumerable != m.Arguments)
{
return Expression.Call(expression, m.Method, enumerable);
}
return m;
}
// Token: 0x060001D8 RID: 472 RVA: 0x0000AD50 File Offset: 0x00008F50
protected virtual ReadOnlyCollection<Expression> VisitExpressionList(ReadOnlyCollection<Expression> original)
{
IList<Expression> list = this.VisitList<Expression>(original, new Func<Expression, Expression>(this.Visit));
if (list == null)
{
return original;
}
return new ReadOnlyCollection<Expression>(list);
}
// Token: 0x060001D9 RID: 473 RVA: 0x0000AD80 File Offset: 0x00008F80
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
Expression expression = this.Visit(assignment.Expression);
if (expression != assignment.Expression)
{
return Expression.Bind(assignment.Member, expression);
}
return assignment;
}
// Token: 0x060001DA RID: 474 RVA: 0x0000ADB4 File Offset: 0x00008FB4
protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
{
IEnumerable<MemberBinding> enumerable = this.VisitBindingList(binding.Bindings);
if (enumerable != binding.Bindings)
{
return Expression.MemberBind(binding.Member, enumerable);
}
return binding;
}
// Token: 0x060001DB RID: 475 RVA: 0x0000ADE8 File Offset: 0x00008FE8
protected virtual MemberListBinding VisitMemberListBinding(MemberListBinding binding)
{
IEnumerable<ElementInit> enumerable = this.VisitElementInitializerList(binding.Initializers);
if (enumerable != binding.Initializers)
{
return Expression.ListBind(binding.Member, enumerable);
}
return binding;
}
// Token: 0x060001DC RID: 476 RVA: 0x0000AE1C File Offset: 0x0000901C
protected virtual IEnumerable<MemberBinding> VisitBindingList(ReadOnlyCollection<MemberBinding> original)
{
return this.VisitList<MemberBinding>(original, new Func<MemberBinding, MemberBinding>(this.VisitBinding));
}
// Token: 0x060001DD RID: 477 RVA: 0x0000AE34 File Offset: 0x00009034
protected virtual IEnumerable<ElementInit> VisitElementInitializerList(ReadOnlyCollection<ElementInit> original)
{
return this.VisitList<ElementInit>(original, new Func<ElementInit, ElementInit>(this.VisitElementInitializer));
}
// Token: 0x060001DE RID: 478 RVA: 0x0000AE4C File Offset: 0x0000904C
private IList<TElement> VisitList<TElement>(ReadOnlyCollection<TElement> original, Func<TElement, TElement> visit)
{
List<TElement> list = null;
int i = 0;
int count = original.Count;
while (i < count)
{
TElement telement = visit(original[i]);
if (list != null)
{
list.Add(telement);
}
else if (!EqualityComparer<TElement>.Default.Equals(telement, original[i]))
{
list = new List<TElement>(count);
for (int j = 0; j < i; j++)
{
list.Add(original[j]);
}
list.Add(telement);
}
i++;
}
if (list != null)
{
return list;
}
return original;
}
// Token: 0x060001DF RID: 479 RVA: 0x0000AEE8 File Offset: 0x000090E8
protected virtual Expression VisitLambda(LambdaExpression lambda)
{
Expression expression = this.Visit(lambda.Body);
if (expression != lambda.Body)
{
return Expression.Lambda(lambda.Type, expression, lambda.Parameters);
}
return lambda;
}
// Token: 0x060001E0 RID: 480 RVA: 0x0000AF24 File Offset: 0x00009124
protected virtual NewExpression VisitNew(NewExpression nex)
{
IEnumerable<Expression> enumerable = this.VisitExpressionList(nex.Arguments);
if (enumerable == nex.Arguments)
{
return nex;
}
if (nex.Members != null)
{
return Expression.New(nex.Constructor, enumerable, nex.Members);
}
return Expression.New(nex.Constructor, enumerable);
}
// Token: 0x060001E1 RID: 481 RVA: 0x0000AF78 File Offset: 0x00009178
protected virtual Expression VisitMemberInit(MemberInitExpression init)
{
NewExpression newExpression = this.VisitNew(init.NewExpression);
IEnumerable<MemberBinding> enumerable = this.VisitBindingList(init.Bindings);
if (newExpression != init.NewExpression || enumerable != init.Bindings)
{
return Expression.MemberInit(newExpression, enumerable);
}
return init;
}
// Token: 0x060001E2 RID: 482 RVA: 0x0000AFC0 File Offset: 0x000091C0
protected virtual Expression VisitListInit(ListInitExpression init)
{
NewExpression newExpression = this.VisitNew(init.NewExpression);
IEnumerable<ElementInit> enumerable = this.VisitElementInitializerList(init.Initializers);
if (newExpression != init.NewExpression || enumerable != init.Initializers)
{
return Expression.ListInit(newExpression, enumerable);
}
return init;
}
// Token: 0x060001E3 RID: 483 RVA: 0x0000B008 File Offset: 0x00009208
protected virtual Expression VisitNewArray(NewArrayExpression na)
{
IEnumerable<Expression> enumerable = this.VisitExpressionList(na.Expressions);
if (enumerable == na.Expressions)
{
return na;
}
if (na.NodeType == ExpressionType.NewArrayInit)
{
return Expression.NewArrayInit(na.Type.GetElementType(), enumerable);
}
return Expression.NewArrayBounds(na.Type.GetElementType(), enumerable);
}
// Token: 0x060001E4 RID: 484 RVA: 0x0000B060 File Offset: 0x00009260
protected virtual Expression VisitInvocation(InvocationExpression iv)
{
IEnumerable<Expression> enumerable = this.VisitExpressionList(iv.Arguments);
Expression expression = this.Visit(iv.Expression);
if (enumerable != iv.Arguments || expression != iv.Expression)
{
return Expression.Invoke(expression, enumerable);
}
return iv;
}
}
}
@@ -0,0 +1,148 @@
using System;
namespace System.Linq.Expressions
{
/// <summary>Describes the node types for the nodes of an expression tree.</summary>
// Token: 0x0200001F RID: 31
public enum ExpressionType
{
/// <summary>A node that represents arithmetic addition without overflow checking.</summary>
// Token: 0x04000077 RID: 119
Add,
/// <summary>A node that represents arithmetic addition with overflow checking.</summary>
// Token: 0x04000078 RID: 120
AddChecked,
/// <summary>A node that represents a bitwise AND operation.</summary>
// Token: 0x04000079 RID: 121
And,
/// <summary>A node that represents a short-circuiting conditional AND operation.</summary>
// Token: 0x0400007A RID: 122
AndAlso,
/// <summary>A node that represents getting the length of a one-dimensional array.</summary>
// Token: 0x0400007B RID: 123
ArrayLength,
/// <summary>A node that represents indexing into a one-dimensional array.</summary>
// Token: 0x0400007C RID: 124
ArrayIndex,
/// <summary>A node that represents a method call.</summary>
// Token: 0x0400007D RID: 125
Call,
/// <summary>A node that represents a null coalescing operation.</summary>
// Token: 0x0400007E RID: 126
Coalesce,
/// <summary>A node that represents a conditional operation.</summary>
// Token: 0x0400007F RID: 127
Conditional,
/// <summary>A node that represents an expression that has a constant value.</summary>
// Token: 0x04000080 RID: 128
Constant,
/// <summary>A node that represents a cast or conversion operation. If the operation is a numeric conversion, it overflows silently if the converted value does not fit the target type.</summary>
// Token: 0x04000081 RID: 129
Convert,
/// <summary>A node that represents a cast or conversion operation. If the operation is a numeric conversion, an exception is thrown if the converted value does not fit the target type.</summary>
// Token: 0x04000082 RID: 130
ConvertChecked,
/// <summary>A node that represents arithmetic division.</summary>
// Token: 0x04000083 RID: 131
Divide,
/// <summary>A node that represents an equality comparison.</summary>
// Token: 0x04000084 RID: 132
Equal,
/// <summary>A node that represents a bitwise XOR operation.</summary>
// Token: 0x04000085 RID: 133
ExclusiveOr,
/// <summary>A node that represents a "greater than" numeric comparison.</summary>
// Token: 0x04000086 RID: 134
GreaterThan,
/// <summary>A node that represents a "greater than or equal" numeric comparison.</summary>
// Token: 0x04000087 RID: 135
GreaterThanOrEqual,
/// <summary>A node that represents applying a delegate or lambda expression to a list of argument expressions.</summary>
// Token: 0x04000088 RID: 136
Invoke,
/// <summary>A node that represents a lambda expression.</summary>
// Token: 0x04000089 RID: 137
Lambda,
/// <summary>A node that represents a bitwise left-shift operation.</summary>
// Token: 0x0400008A RID: 138
LeftShift,
/// <summary>A node that represents a "less than" numeric comparison.</summary>
// Token: 0x0400008B RID: 139
LessThan,
/// <summary>A node that represents a "less than or equal" numeric comparison.</summary>
// Token: 0x0400008C RID: 140
LessThanOrEqual,
/// <summary>A node that represents creating a new <see cref="T:System.Collections.IEnumerable" /> object and initializing it from a list of elements.</summary>
// Token: 0x0400008D RID: 141
ListInit,
/// <summary>A node that represents reading from a field or property.</summary>
// Token: 0x0400008E RID: 142
MemberAccess,
/// <summary>A node that represents creating a new object and initializing one or more of its members.</summary>
// Token: 0x0400008F RID: 143
MemberInit,
/// <summary>A node that represents an arithmetic remainder operation.</summary>
// Token: 0x04000090 RID: 144
Modulo,
/// <summary>A node that represents arithmetic multiplication without overflow checking.</summary>
// Token: 0x04000091 RID: 145
Multiply,
/// <summary>A node that represents arithmetic multiplication with overflow checking.</summary>
// Token: 0x04000092 RID: 146
MultiplyChecked,
/// <summary>A node that represents an arithmetic negation operation.</summary>
// Token: 0x04000093 RID: 147
Negate,
/// <summary>A node that represents a unary plus operation. The result of a predefined unary plus operation is simply the value of the operand, but user-defined implementations may have non-trivial results.</summary>
// Token: 0x04000094 RID: 148
UnaryPlus,
/// <summary>A node that represents an arithmetic negation operation that has overflow checking.</summary>
// Token: 0x04000095 RID: 149
NegateChecked,
/// <summary>A node that represents calling a constructor to create a new object.</summary>
// Token: 0x04000096 RID: 150
New,
/// <summary>A node that represents creating a new one-dimensional array and initializing it from a list of elements.</summary>
// Token: 0x04000097 RID: 151
NewArrayInit,
/// <summary>A node that represents creating a new array where the bounds for each dimension are specified.</summary>
// Token: 0x04000098 RID: 152
NewArrayBounds,
/// <summary>A node that represents a bitwise complement operation.</summary>
// Token: 0x04000099 RID: 153
Not,
/// <summary>A node that represents an inequality comparison.</summary>
// Token: 0x0400009A RID: 154
NotEqual,
/// <summary>A node that represents a bitwise OR operation.</summary>
// Token: 0x0400009B RID: 155
Or,
/// <summary>A node that represents a short-circuiting conditional OR operation.</summary>
// Token: 0x0400009C RID: 156
OrElse,
/// <summary>A node that represents a reference to a parameter defined in the context of the expression.</summary>
// Token: 0x0400009D RID: 157
Parameter,
/// <summary>A node that represents raising a number to a power.</summary>
// Token: 0x0400009E RID: 158
Power,
/// <summary>A node that represents an expression that has a constant value of type <see cref="T:System.Linq.Expressions.Expression" />. A <see cref="F:System.Linq.Expressions.ExpressionType.Quote" /> node can contain references to parameters defined in the context of the expression it represents.</summary>
// Token: 0x0400009F RID: 159
Quote,
/// <summary>A node that represents a bitwise right-shift operation.</summary>
// Token: 0x040000A0 RID: 160
RightShift,
/// <summary>A node that represents arithmetic subtraction without overflow checking.</summary>
// Token: 0x040000A1 RID: 161
Subtract,
/// <summary>A node that represents arithmetic subtraction with overflow checking.</summary>
// Token: 0x040000A2 RID: 162
SubtractChecked,
/// <summary>A node that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.</summary>
// Token: 0x040000A3 RID: 163
TypeAs,
/// <summary>A node that represents a type test.</summary>
// Token: 0x040000A4 RID: 164
TypeIs
}
}
@@ -0,0 +1,257 @@
using System;
using System.Collections.ObjectModel;
namespace System.Linq.Expressions
{
// Token: 0x02000020 RID: 32
internal abstract class ExpressionVisitor
{
// Token: 0x060001E6 RID: 486 RVA: 0x0000B0B0 File Offset: 0x000092B0
protected virtual void Visit(Expression expression)
{
if (expression == null)
{
return;
}
switch (expression.NodeType)
{
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.And:
case ExpressionType.AndAlso:
case ExpressionType.ArrayIndex:
case ExpressionType.Coalesce:
case ExpressionType.Divide:
case ExpressionType.Equal:
case ExpressionType.ExclusiveOr:
case ExpressionType.GreaterThan:
case ExpressionType.GreaterThanOrEqual:
case ExpressionType.LeftShift:
case ExpressionType.LessThan:
case ExpressionType.LessThanOrEqual:
case ExpressionType.Modulo:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
case ExpressionType.NotEqual:
case ExpressionType.Or:
case ExpressionType.OrElse:
case ExpressionType.Power:
case ExpressionType.RightShift:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
this.VisitBinary((BinaryExpression)expression);
break;
case ExpressionType.ArrayLength:
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
case ExpressionType.Negate:
case ExpressionType.UnaryPlus:
case ExpressionType.NegateChecked:
case ExpressionType.Not:
case ExpressionType.Quote:
case ExpressionType.TypeAs:
this.VisitUnary((UnaryExpression)expression);
break;
case ExpressionType.Call:
this.VisitMethodCall((MethodCallExpression)expression);
break;
case ExpressionType.Conditional:
this.VisitConditional((ConditionalExpression)expression);
break;
case ExpressionType.Constant:
this.VisitConstant((ConstantExpression)expression);
break;
case ExpressionType.Invoke:
this.VisitInvocation((InvocationExpression)expression);
break;
case ExpressionType.Lambda:
this.VisitLambda((LambdaExpression)expression);
break;
case ExpressionType.ListInit:
this.VisitListInit((ListInitExpression)expression);
break;
case ExpressionType.MemberAccess:
this.VisitMemberAccess((MemberExpression)expression);
break;
case ExpressionType.MemberInit:
this.VisitMemberInit((MemberInitExpression)expression);
break;
case ExpressionType.New:
this.VisitNew((NewExpression)expression);
break;
case ExpressionType.NewArrayInit:
case ExpressionType.NewArrayBounds:
this.VisitNewArray((NewArrayExpression)expression);
break;
case ExpressionType.Parameter:
this.VisitParameter((ParameterExpression)expression);
break;
case ExpressionType.TypeIs:
this.VisitTypeIs((TypeBinaryExpression)expression);
break;
default:
throw new ArgumentException(string.Format("Unhandled expression type: '{0}'", expression.NodeType));
}
}
// Token: 0x060001E7 RID: 487 RVA: 0x0000B298 File Offset: 0x00009498
protected virtual void VisitBinding(MemberBinding binding)
{
switch (binding.BindingType)
{
case MemberBindingType.Assignment:
this.VisitMemberAssignment((MemberAssignment)binding);
break;
case MemberBindingType.MemberBinding:
this.VisitMemberMemberBinding((MemberMemberBinding)binding);
break;
case MemberBindingType.ListBinding:
this.VisitMemberListBinding((MemberListBinding)binding);
break;
default:
throw new ArgumentException(string.Format("Unhandled binding type '{0}'", binding.BindingType));
}
}
// Token: 0x060001E8 RID: 488 RVA: 0x0000B314 File Offset: 0x00009514
protected virtual void VisitElementInitializer(ElementInit initializer)
{
this.VisitExpressionList(initializer.Arguments);
}
// Token: 0x060001E9 RID: 489 RVA: 0x0000B324 File Offset: 0x00009524
protected virtual void VisitUnary(UnaryExpression unary)
{
this.Visit(unary.Operand);
}
// Token: 0x060001EA RID: 490 RVA: 0x0000B334 File Offset: 0x00009534
protected virtual void VisitBinary(BinaryExpression binary)
{
this.Visit(binary.Left);
this.Visit(binary.Right);
this.Visit(binary.Conversion);
}
// Token: 0x060001EB RID: 491 RVA: 0x0000B368 File Offset: 0x00009568
protected virtual void VisitTypeIs(TypeBinaryExpression type)
{
this.Visit(type.Expression);
}
// Token: 0x060001EC RID: 492 RVA: 0x0000B378 File Offset: 0x00009578
protected virtual void VisitConstant(ConstantExpression constant)
{
}
// Token: 0x060001ED RID: 493 RVA: 0x0000B37C File Offset: 0x0000957C
protected virtual void VisitConditional(ConditionalExpression conditional)
{
this.Visit(conditional.Test);
this.Visit(conditional.IfTrue);
this.Visit(conditional.IfFalse);
}
// Token: 0x060001EE RID: 494 RVA: 0x0000B3B0 File Offset: 0x000095B0
protected virtual void VisitParameter(ParameterExpression parameter)
{
}
// Token: 0x060001EF RID: 495 RVA: 0x0000B3B4 File Offset: 0x000095B4
protected virtual void VisitMemberAccess(MemberExpression member)
{
this.Visit(member.Expression);
}
// Token: 0x060001F0 RID: 496 RVA: 0x0000B3C4 File Offset: 0x000095C4
protected virtual void VisitMethodCall(MethodCallExpression methodCall)
{
this.Visit(methodCall.Object);
this.VisitExpressionList(methodCall.Arguments);
}
// Token: 0x060001F1 RID: 497 RVA: 0x0000B3EC File Offset: 0x000095EC
protected virtual void VisitList<T>(ReadOnlyCollection<T> list, Action<T> visitor)
{
foreach (T t in list)
{
visitor(t);
}
}
// Token: 0x060001F2 RID: 498 RVA: 0x0000B44C File Offset: 0x0000964C
protected virtual void VisitExpressionList(ReadOnlyCollection<Expression> list)
{
this.VisitList<Expression>(list, new Action<Expression>(this.Visit));
}
// Token: 0x060001F3 RID: 499 RVA: 0x0000B464 File Offset: 0x00009664
protected virtual void VisitMemberAssignment(MemberAssignment assignment)
{
this.Visit(assignment.Expression);
}
// Token: 0x060001F4 RID: 500 RVA: 0x0000B474 File Offset: 0x00009674
protected virtual void VisitMemberMemberBinding(MemberMemberBinding binding)
{
this.VisitBindingList(binding.Bindings);
}
// Token: 0x060001F5 RID: 501 RVA: 0x0000B484 File Offset: 0x00009684
protected virtual void VisitMemberListBinding(MemberListBinding binding)
{
this.VisitElementInitializerList(binding.Initializers);
}
// Token: 0x060001F6 RID: 502 RVA: 0x0000B494 File Offset: 0x00009694
protected virtual void VisitBindingList(ReadOnlyCollection<MemberBinding> list)
{
this.VisitList<MemberBinding>(list, new Action<MemberBinding>(this.VisitBinding));
}
// Token: 0x060001F7 RID: 503 RVA: 0x0000B4AC File Offset: 0x000096AC
protected virtual void VisitElementInitializerList(ReadOnlyCollection<ElementInit> list)
{
this.VisitList<ElementInit>(list, new Action<ElementInit>(this.VisitElementInitializer));
}
// Token: 0x060001F8 RID: 504 RVA: 0x0000B4C4 File Offset: 0x000096C4
protected virtual void VisitLambda(LambdaExpression lambda)
{
this.Visit(lambda.Body);
}
// Token: 0x060001F9 RID: 505 RVA: 0x0000B4D4 File Offset: 0x000096D4
protected virtual void VisitNew(NewExpression nex)
{
this.VisitExpressionList(nex.Arguments);
}
// Token: 0x060001FA RID: 506 RVA: 0x0000B4E4 File Offset: 0x000096E4
protected virtual void VisitMemberInit(MemberInitExpression init)
{
this.VisitNew(init.NewExpression);
this.VisitBindingList(init.Bindings);
}
// Token: 0x060001FB RID: 507 RVA: 0x0000B50C File Offset: 0x0000970C
protected virtual void VisitListInit(ListInitExpression init)
{
this.VisitNew(init.NewExpression);
this.VisitElementInitializerList(init.Initializers);
}
// Token: 0x060001FC RID: 508 RVA: 0x0000B534 File Offset: 0x00009734
protected virtual void VisitNewArray(NewArrayExpression newArray)
{
this.VisitExpressionList(newArray.Expressions);
}
// Token: 0x060001FD RID: 509 RVA: 0x0000B544 File Offset: 0x00009744
protected virtual void VisitInvocation(InvocationExpression invocation)
{
this.VisitExpressionList(invocation.Arguments);
this.Visit(invocation.Expression);
}
}
}
@@ -0,0 +1,138 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace System.Linq.Expressions
{
// Token: 0x02000021 RID: 33
internal static class Extensions
{
// Token: 0x060001FE RID: 510 RVA: 0x0000B56C File Offset: 0x0000976C
public static bool IsGenericInstanceOf(this Type self, Type type)
{
return self.IsGenericType && self.GetGenericTypeDefinition() == type;
}
// Token: 0x060001FF RID: 511 RVA: 0x0000B584 File Offset: 0x00009784
public static bool IsNullable(this Type self)
{
return self.IsValueType && self.IsGenericInstanceOf(typeof(Nullable<>));
}
// Token: 0x06000200 RID: 512 RVA: 0x0000B5A4 File Offset: 0x000097A4
public static bool IsExpression(this Type self)
{
return self == typeof(Expression) || self.IsSubclassOf(typeof(Expression));
}
// Token: 0x06000201 RID: 513 RVA: 0x0000B5CC File Offset: 0x000097CC
public static bool IsGenericImplementationOf(this Type self, Type type)
{
foreach (Type type2 in self.GetInterfaces())
{
if (type2.IsGenericInstanceOf(type))
{
return true;
}
}
return false;
}
// Token: 0x06000202 RID: 514 RVA: 0x0000B608 File Offset: 0x00009808
public static bool IsAssignableTo(this Type self, Type type)
{
return type.IsAssignableFrom(self) || Extensions.ArrayTypeIsAssignableTo(self, type);
}
// Token: 0x06000203 RID: 515 RVA: 0x0000B620 File Offset: 0x00009820
public static Type GetFirstGenericArgument(this Type self)
{
return self.GetGenericArguments()[0];
}
// Token: 0x06000204 RID: 516 RVA: 0x0000B62C File Offset: 0x0000982C
public static Type MakeGenericTypeFrom(this Type self, Type type)
{
return self.MakeGenericType(type.GetGenericArguments());
}
// Token: 0x06000205 RID: 517 RVA: 0x0000B63C File Offset: 0x0000983C
public static Type MakeNullableType(this Type self)
{
return typeof(Nullable<>).MakeGenericType(new Type[] { self });
}
// Token: 0x06000206 RID: 518 RVA: 0x0000B658 File Offset: 0x00009858
public static Type GetNotNullableType(this Type self)
{
return (!self.IsNullable()) ? self : self.GetFirstGenericArgument();
}
// Token: 0x06000207 RID: 519 RVA: 0x0000B674 File Offset: 0x00009874
public static MethodInfo GetInvokeMethod(this Type self)
{
return self.GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public);
}
// Token: 0x06000208 RID: 520 RVA: 0x0000B684 File Offset: 0x00009884
public static MethodInfo MakeGenericMethodFrom(this MethodInfo self, MethodInfo method)
{
return self.MakeGenericMethod(method.GetGenericArguments());
}
// Token: 0x06000209 RID: 521 RVA: 0x0000B694 File Offset: 0x00009894
public static Type[] GetParameterTypes(this MethodBase self)
{
ParameterInfo[] parameters = self.GetParameters();
Type[] array = new Type[parameters.Length];
for (int i = 0; i < array.Length; i++)
{
array[i] = parameters[i].ParameterType;
}
return array;
}
// Token: 0x0600020A RID: 522 RVA: 0x0000B6D4 File Offset: 0x000098D4
private static bool ArrayTypeIsAssignableTo(Type type, Type candidate)
{
return type.IsArray && candidate.IsArray && type.GetArrayRank() == candidate.GetArrayRank() && type.GetElementType().IsAssignableTo(candidate.GetElementType());
}
// Token: 0x0600020B RID: 523 RVA: 0x0000B720 File Offset: 0x00009920
public static void OnFieldOrProperty(this MemberInfo self, Action<FieldInfo> onfield, Action<PropertyInfo> onprop)
{
MemberTypes memberType = self.MemberType;
if (memberType == MemberTypes.Field)
{
onfield((FieldInfo)self);
return;
}
if (memberType != MemberTypes.Property)
{
throw new ArgumentException();
}
onprop((PropertyInfo)self);
}
// Token: 0x0600020C RID: 524 RVA: 0x0000B768 File Offset: 0x00009968
public static T OnFieldOrProperty<T>(this MemberInfo self, Func<FieldInfo, T> onfield, Func<PropertyInfo, T> onprop)
{
MemberTypes memberType = self.MemberType;
if (memberType == MemberTypes.Field)
{
return onfield((FieldInfo)self);
}
if (memberType != MemberTypes.Property)
{
throw new ArgumentException();
}
return onprop((PropertyInfo)self);
}
// Token: 0x0600020D RID: 525 RVA: 0x0000B7B0 File Offset: 0x000099B0
public static Type MakeStrongBoxType(this Type self)
{
return typeof(StrongBox<>).MakeGenericType(new Type[] { self });
}
}
}
@@ -0,0 +1,54 @@
using System;
using System.Collections.ObjectModel;
namespace System.Linq.Expressions
{
/// <summary>Represents an expression that applies a delegate or lambda expression to a list of argument expressions.</summary>
// Token: 0x02000022 RID: 34
public sealed class InvocationExpression : Expression
{
// Token: 0x0600020E RID: 526 RVA: 0x0000B7CC File Offset: 0x000099CC
internal InvocationExpression(Expression expression, Type type, ReadOnlyCollection<Expression> arguments)
: base(ExpressionType.Invoke, type)
{
this.expression = expression;
this.arguments = arguments;
}
/// <summary>Gets the delegate or lambda expression to be applied.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the delegate to be applied.</returns>
// Token: 0x1700001F RID: 31
// (get) Token: 0x0600020F RID: 527 RVA: 0x0000B7E8 File Offset: 0x000099E8
public Expression Expression
{
get
{
return this.expression;
}
}
/// <summary>Gets the arguments that the delegate is applied to.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent the arguments that the delegate is applied to.</returns>
// Token: 0x17000020 RID: 32
// (get) Token: 0x06000210 RID: 528 RVA: 0x0000B7F0 File Offset: 0x000099F0
public ReadOnlyCollection<Expression> Arguments
{
get
{
return this.arguments;
}
}
// Token: 0x06000211 RID: 529 RVA: 0x0000B7F8 File Offset: 0x000099F8
internal override void Emit(EmitContext ec)
{
ec.EmitCall(this.expression, this.arguments, this.expression.Type.GetInvokeMethod());
}
// Token: 0x040000A5 RID: 165
private Expression expression;
// Token: 0x040000A6 RID: 166
private ReadOnlyCollection<Expression> arguments;
}
}
@@ -0,0 +1,88 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Describes a lambda expression.</summary>
// Token: 0x02000004 RID: 4
public class LambdaExpression : Expression
{
// Token: 0x06000004 RID: 4 RVA: 0x00002118 File Offset: 0x00000318
internal LambdaExpression(Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
: base(ExpressionType.Lambda, delegateType)
{
this.body = body;
this.parameters = parameters;
}
/// <summary>Gets the body of the lambda expression.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the body of the lambda expression.</returns>
// Token: 0x17000001 RID: 1
// (get) Token: 0x06000005 RID: 5 RVA: 0x00002134 File Offset: 0x00000334
public Expression Body
{
get
{
return this.body;
}
}
/// <summary>Gets the parameters of the lambda expression.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects that represent the parameters of the lambda expression.</returns>
// Token: 0x17000002 RID: 2
// (get) Token: 0x06000006 RID: 6 RVA: 0x0000213C File Offset: 0x0000033C
public ReadOnlyCollection<ParameterExpression> Parameters
{
get
{
return this.parameters;
}
}
// Token: 0x06000007 RID: 7 RVA: 0x00002144 File Offset: 0x00000344
private void EmitPopIfNeeded(EmitContext ec)
{
if (this.GetReturnType() == typeof(void) && this.body.Type != typeof(void))
{
ec.ig.Emit(OpCodes.Pop);
}
}
// Token: 0x06000008 RID: 8 RVA: 0x00002190 File Offset: 0x00000390
internal override void Emit(EmitContext ec)
{
ec.EmitCreateDelegate(this);
}
// Token: 0x06000009 RID: 9 RVA: 0x0000219C File Offset: 0x0000039C
internal void EmitBody(EmitContext ec)
{
this.body.Emit(ec);
this.EmitPopIfNeeded(ec);
ec.ig.Emit(OpCodes.Ret);
}
// Token: 0x0600000A RID: 10 RVA: 0x000021C4 File Offset: 0x000003C4
internal Type GetReturnType()
{
return base.Type.GetInvokeMethod().ReturnType;
}
/// <summary>Produces a delegate that represents the lambda expression.</summary>
/// <returns>A <see cref="T:System.Delegate" /> that, when it is executed, has the behavior described by the semantics of the <see cref="T:System.Linq.Expressions.LambdaExpression" />.</returns>
// Token: 0x0600000B RID: 11 RVA: 0x000021D8 File Offset: 0x000003D8
public Delegate Compile()
{
CompilationContext compilationContext = new CompilationContext();
compilationContext.AddCompilationUnit(this);
return compilationContext.CreateDelegate();
}
// Token: 0x04000001 RID: 1
private Expression body;
// Token: 0x04000002 RID: 2
private ReadOnlyCollection<ParameterExpression> parameters;
}
}
@@ -0,0 +1,57 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents a constructor call that has a collection initializer.</summary>
// Token: 0x02000023 RID: 35
public sealed class ListInitExpression : Expression
{
// Token: 0x06000212 RID: 530 RVA: 0x0000B828 File Offset: 0x00009A28
internal ListInitExpression(NewExpression new_expression, ReadOnlyCollection<ElementInit> initializers)
: base(ExpressionType.ListInit, new_expression.Type)
{
this.new_expression = new_expression;
this.initializers = initializers;
}
/// <summary>Gets the expression that contains a call to the constructor of a collection type.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that represents the call to the constructor of a collection type.</returns>
// Token: 0x17000021 RID: 33
// (get) Token: 0x06000213 RID: 531 RVA: 0x0000B848 File Offset: 0x00009A48
public NewExpression NewExpression
{
get
{
return this.new_expression;
}
}
/// <summary>Gets the element initializers that are used to initialize a collection.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ElementInit" /> objects which represent the elements that are used to initialize the collection.</returns>
// Token: 0x17000022 RID: 34
// (get) Token: 0x06000214 RID: 532 RVA: 0x0000B850 File Offset: 0x00009A50
public ReadOnlyCollection<ElementInit> Initializers
{
get
{
return this.initializers;
}
}
// Token: 0x06000215 RID: 533 RVA: 0x0000B858 File Offset: 0x00009A58
internal override void Emit(EmitContext ec)
{
LocalBuilder localBuilder = ec.EmitStored(this.new_expression);
ec.EmitCollection(this.initializers, localBuilder);
ec.EmitLoad(localBuilder);
}
// Token: 0x040000A7 RID: 167
private NewExpression new_expression;
// Token: 0x040000A8 RID: 168
private ReadOnlyCollection<ElementInit> initializers;
}
}
@@ -0,0 +1,66 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents initializing a field or property of a newly created object.</summary>
// Token: 0x02000024 RID: 36
public sealed class MemberAssignment : MemberBinding
{
// Token: 0x06000216 RID: 534 RVA: 0x0000B888 File Offset: 0x00009A88
internal MemberAssignment(MemberInfo member, Expression expression)
: base(MemberBindingType.Assignment, member)
{
this.expression = expression;
}
/// <summary>Gets the expression to assign to the field or property.</summary>
/// <returns>The <see cref="T:System.Linq.Expressions.Expression" /> that represents the value to assign to the field or property.</returns>
// Token: 0x17000023 RID: 35
// (get) Token: 0x06000217 RID: 535 RVA: 0x0000B89C File Offset: 0x00009A9C
public Expression Expression
{
get
{
return this.expression;
}
}
// Token: 0x06000218 RID: 536 RVA: 0x0000B8A4 File Offset: 0x00009AA4
internal override void Emit(EmitContext ec, LocalBuilder local)
{
base.Member.OnFieldOrProperty(delegate(FieldInfo field)
{
this.EmitFieldAssignment(ec, field, local);
}, delegate(PropertyInfo prop)
{
this.EmitPropertyAssignment(ec, prop, local);
});
}
// Token: 0x06000219 RID: 537 RVA: 0x0000B8F0 File Offset: 0x00009AF0
private void EmitFieldAssignment(EmitContext ec, FieldInfo field, LocalBuilder local)
{
ec.EmitLoadSubject(local);
this.expression.Emit(ec);
ec.ig.Emit(OpCodes.Stfld, field);
}
// Token: 0x0600021A RID: 538 RVA: 0x0000B924 File Offset: 0x00009B24
private void EmitPropertyAssignment(EmitContext ec, PropertyInfo property, LocalBuilder local)
{
MethodInfo setMethod = property.GetSetMethod(true);
if (setMethod == null)
{
throw new InvalidOperationException();
}
ec.EmitLoadSubject(local);
this.expression.Emit(ec);
ec.EmitCall(setMethod);
}
// Token: 0x040000A9 RID: 169
private Expression expression;
}
}
@@ -0,0 +1,92 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Provides the base class from which the classes that represent bindings that are used to initialize members of a newly created object derive.</summary>
// Token: 0x02000025 RID: 37
public abstract class MemberBinding
{
/// <summary>Initializes a new instance of the <see cref="T:System.Linq.Expressions.MemberBinding" /> class.</summary>
/// <param name="type">The <see cref="T:System.Linq.Expressions.MemberBindingType" /> that discriminates the type of binding that is represented.</param>
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to be initialized.</param>
// Token: 0x0600021B RID: 539 RVA: 0x0000B960 File Offset: 0x00009B60
protected MemberBinding(MemberBindingType binding_type, MemberInfo member)
{
this.binding_type = binding_type;
this.member = member;
}
/// <summary>Gets the type of binding that is represented.</summary>
/// <returns>One of the <see cref="T:System.Linq.Expressions.MemberBindingType" /> values.</returns>
// Token: 0x17000024 RID: 36
// (get) Token: 0x0600021C RID: 540 RVA: 0x0000B978 File Offset: 0x00009B78
public MemberBindingType BindingType
{
get
{
return this.binding_type;
}
}
/// <summary>Gets the field or property to be initialized.</summary>
/// <returns>The <see cref="T:System.Reflection.MemberInfo" /> that represents the field or property to be initialized.</returns>
// Token: 0x17000025 RID: 37
// (get) Token: 0x0600021D RID: 541 RVA: 0x0000B980 File Offset: 0x00009B80
public MemberInfo Member
{
get
{
return this.member;
}
}
/// <summary>Returns a textual representation of the <see cref="T:System.Linq.Expressions.MemberBinding" />.</summary>
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.MemberBinding" />.</returns>
// Token: 0x0600021E RID: 542 RVA: 0x0000B988 File Offset: 0x00009B88
public override string ToString()
{
return ExpressionPrinter.ToString(this);
}
// Token: 0x0600021F RID: 543
internal abstract void Emit(EmitContext ec, LocalBuilder local);
// Token: 0x06000220 RID: 544 RVA: 0x0000B990 File Offset: 0x00009B90
internal LocalBuilder EmitLoadMember(EmitContext ec, LocalBuilder local)
{
ec.EmitLoadSubject(local);
return this.member.OnFieldOrProperty((FieldInfo field) => this.EmitLoadField(ec, field), (PropertyInfo prop) => this.EmitLoadProperty(ec, prop));
}
// Token: 0x06000221 RID: 545 RVA: 0x0000B9E0 File Offset: 0x00009BE0
private LocalBuilder EmitLoadProperty(EmitContext ec, PropertyInfo property)
{
MethodInfo getMethod = property.GetGetMethod(true);
if (getMethod == null)
{
throw new NotSupportedException();
}
LocalBuilder localBuilder = ec.ig.DeclareLocal(property.PropertyType);
ec.EmitCall(getMethod);
ec.ig.Emit(OpCodes.Stloc, localBuilder);
return localBuilder;
}
// Token: 0x06000222 RID: 546 RVA: 0x0000BA2C File Offset: 0x00009C2C
private LocalBuilder EmitLoadField(EmitContext ec, FieldInfo field)
{
LocalBuilder localBuilder = ec.ig.DeclareLocal(field.FieldType);
ec.ig.Emit(OpCodes.Ldfld, field);
ec.ig.Emit(OpCodes.Stloc, localBuilder);
return localBuilder;
}
// Token: 0x040000AA RID: 170
private MemberBindingType binding_type;
// Token: 0x040000AB RID: 171
private MemberInfo member;
}
}
@@ -0,0 +1,19 @@
using System;
namespace System.Linq.Expressions
{
/// <summary>Describes the binding types that are used in <see cref="T:System.Linq.Expressions.MemberInitExpression" /> objects.</summary>
// Token: 0x02000026 RID: 38
public enum MemberBindingType
{
/// <summary>A binding that represents initializing a member with the value of an expression.</summary>
// Token: 0x040000AD RID: 173
Assignment,
/// <summary>A binding that represents recursively initializing members of a member.</summary>
// Token: 0x040000AE RID: 174
MemberBinding,
/// <summary>A binding that represents initializing a member of type <see cref="T:System.Collections.IList" /> or <see cref="T:System.Collections.Generic.ICollection`1" /> from a list of elements.</summary>
// Token: 0x040000AF RID: 175
ListBinding
}
}
@@ -0,0 +1,86 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents accessing a field or property.</summary>
// Token: 0x02000027 RID: 39
public sealed class MemberExpression : Expression
{
// Token: 0x06000223 RID: 547 RVA: 0x0000BA70 File Offset: 0x00009C70
internal MemberExpression(Expression expression, MemberInfo member, Type type)
: base(ExpressionType.MemberAccess, type)
{
this.expression = expression;
this.member = member;
}
/// <summary>Gets the containing object of the field or property.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the containing object of the field or property.</returns>
// Token: 0x17000026 RID: 38
// (get) Token: 0x06000224 RID: 548 RVA: 0x0000BA8C File Offset: 0x00009C8C
public Expression Expression
{
get
{
return this.expression;
}
}
/// <summary>Gets the field or property to be accessed.</summary>
/// <returns>The <see cref="T:System.Reflection.MemberInfo" /> that represents the field or property to be accessed.</returns>
// Token: 0x17000027 RID: 39
// (get) Token: 0x06000225 RID: 549 RVA: 0x0000BA94 File Offset: 0x00009C94
public MemberInfo Member
{
get
{
return this.member;
}
}
// Token: 0x06000226 RID: 550 RVA: 0x0000BA9C File Offset: 0x00009C9C
internal override void Emit(EmitContext ec)
{
this.member.OnFieldOrProperty(delegate(FieldInfo field)
{
this.EmitFieldAccess(ec, field);
}, delegate(PropertyInfo prop)
{
this.EmitPropertyAccess(ec, prop);
});
}
// Token: 0x06000227 RID: 551 RVA: 0x0000BAE0 File Offset: 0x00009CE0
private void EmitPropertyAccess(EmitContext ec, PropertyInfo property)
{
MethodInfo getMethod = property.GetGetMethod(true);
if (!getMethod.IsStatic)
{
ec.EmitLoadSubject(this.expression);
}
ec.EmitCall(getMethod);
}
// Token: 0x06000228 RID: 552 RVA: 0x0000BB14 File Offset: 0x00009D14
private void EmitFieldAccess(EmitContext ec, FieldInfo field)
{
if (!field.IsStatic)
{
ec.EmitLoadSubject(this.expression);
ec.ig.Emit(OpCodes.Ldfld, field);
}
else
{
ec.ig.Emit(OpCodes.Ldsfld, field);
}
}
// Token: 0x040000B0 RID: 176
private Expression expression;
// Token: 0x040000B1 RID: 177
private MemberInfo member;
}
}
@@ -0,0 +1,57 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents calling a constructor and initializing one or more members of the new object.</summary>
// Token: 0x02000028 RID: 40
public sealed class MemberInitExpression : Expression
{
// Token: 0x06000229 RID: 553 RVA: 0x0000BB60 File Offset: 0x00009D60
internal MemberInitExpression(NewExpression new_expression, ReadOnlyCollection<MemberBinding> bindings)
: base(ExpressionType.MemberInit, new_expression.Type)
{
this.new_expression = new_expression;
this.bindings = bindings;
}
/// <summary>Gets the expression that represents the constructor call.</summary>
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that represents the constructor call.</returns>
// Token: 0x17000028 RID: 40
// (get) Token: 0x0600022A RID: 554 RVA: 0x0000BB80 File Offset: 0x00009D80
public NewExpression NewExpression
{
get
{
return this.new_expression;
}
}
/// <summary>Gets the bindings that describe how to initialize the members of the newly created object.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects which describe how to initialize the members.</returns>
// Token: 0x17000029 RID: 41
// (get) Token: 0x0600022B RID: 555 RVA: 0x0000BB88 File Offset: 0x00009D88
public ReadOnlyCollection<MemberBinding> Bindings
{
get
{
return this.bindings;
}
}
// Token: 0x0600022C RID: 556 RVA: 0x0000BB90 File Offset: 0x00009D90
internal override void Emit(EmitContext ec)
{
LocalBuilder localBuilder = ec.EmitStored(this.new_expression);
ec.EmitCollection(this.bindings, localBuilder);
ec.EmitLoad(localBuilder);
}
// Token: 0x040000B2 RID: 178
private NewExpression new_expression;
// Token: 0x040000B3 RID: 179
private ReadOnlyCollection<MemberBinding> bindings;
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents initializing the elements of a collection member of a newly created object.</summary>
// Token: 0x02000029 RID: 41
public sealed class MemberListBinding : MemberBinding
{
// Token: 0x0600022D RID: 557 RVA: 0x0000BBC0 File Offset: 0x00009DC0
internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers)
: base(MemberBindingType.ListBinding, member)
{
this.initializers = initializers;
}
/// <summary>Gets the element initializers for initializing a collection member of a newly created object.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection member with.</returns>
// Token: 0x1700002A RID: 42
// (get) Token: 0x0600022E RID: 558 RVA: 0x0000BBD4 File Offset: 0x00009DD4
public ReadOnlyCollection<ElementInit> Initializers
{
get
{
return this.initializers;
}
}
// Token: 0x0600022F RID: 559 RVA: 0x0000BBDC File Offset: 0x00009DDC
internal override void Emit(EmitContext ec, LocalBuilder local)
{
LocalBuilder localBuilder = base.EmitLoadMember(ec, local);
foreach (ElementInit elementInit in this.initializers)
{
elementInit.Emit(ec, localBuilder);
}
}
// Token: 0x040000B4 RID: 180
private ReadOnlyCollection<ElementInit> initializers;
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents initializing members of a member of a newly created object.</summary>
// Token: 0x0200002A RID: 42
public sealed class MemberMemberBinding : MemberBinding
{
// Token: 0x06000230 RID: 560 RVA: 0x0000BC4C File Offset: 0x00009E4C
internal MemberMemberBinding(MemberInfo member, ReadOnlyCollection<MemberBinding> bindings)
: base(MemberBindingType.MemberBinding, member)
{
this.bindings = bindings;
}
/// <summary>Gets the bindings that describe how to initialize the members of a member.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects that describe how to initialize the members of the member.</returns>
// Token: 0x1700002B RID: 43
// (get) Token: 0x06000231 RID: 561 RVA: 0x0000BC60 File Offset: 0x00009E60
public ReadOnlyCollection<MemberBinding> Bindings
{
get
{
return this.bindings;
}
}
// Token: 0x06000232 RID: 562 RVA: 0x0000BC68 File Offset: 0x00009E68
internal override void Emit(EmitContext ec, LocalBuilder local)
{
LocalBuilder localBuilder = base.EmitLoadMember(ec, local);
foreach (MemberBinding memberBinding in this.bindings)
{
memberBinding.Emit(ec, localBuilder);
}
}
// Token: 0x040000B5 RID: 181
private ReadOnlyCollection<MemberBinding> bindings;
}
}
@@ -0,0 +1,79 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
namespace System.Linq.Expressions
{
/// <summary>Represents calling a method.</summary>
// Token: 0x0200002B RID: 43
public sealed class MethodCallExpression : Expression
{
// Token: 0x06000233 RID: 563 RVA: 0x0000BCD8 File Offset: 0x00009ED8
internal MethodCallExpression(MethodInfo method, ReadOnlyCollection<Expression> arguments)
: base(ExpressionType.Call, method.ReturnType)
{
this.method = method;
this.arguments = arguments;
}
// Token: 0x06000234 RID: 564 RVA: 0x0000BCF8 File Offset: 0x00009EF8
internal MethodCallExpression(Expression obj, MethodInfo method, ReadOnlyCollection<Expression> arguments)
: base(ExpressionType.Call, method.ReturnType)
{
this.obj = obj;
this.method = method;
this.arguments = arguments;
}
/// <summary>Gets the receiving object of the method.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the receiving object of the method.</returns>
// Token: 0x1700002C RID: 44
// (get) Token: 0x06000235 RID: 565 RVA: 0x0000BD28 File Offset: 0x00009F28
public Expression Object
{
get
{
return this.obj;
}
}
/// <summary>Gets the called method.</summary>
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the called method.</returns>
// Token: 0x1700002D RID: 45
// (get) Token: 0x06000236 RID: 566 RVA: 0x0000BD30 File Offset: 0x00009F30
public MethodInfo Method
{
get
{
return this.method;
}
}
/// <summary>Gets the arguments to the called method.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent the arguments to the called method.</returns>
// Token: 0x1700002E RID: 46
// (get) Token: 0x06000237 RID: 567 RVA: 0x0000BD38 File Offset: 0x00009F38
public ReadOnlyCollection<Expression> Arguments
{
get
{
return this.arguments;
}
}
// Token: 0x06000238 RID: 568 RVA: 0x0000BD40 File Offset: 0x00009F40
internal override void Emit(EmitContext ec)
{
ec.EmitCall(this.obj, this.arguments, this.method);
}
// Token: 0x040000B6 RID: 182
private Expression obj;
// Token: 0x040000B7 RID: 183
private MethodInfo method;
// Token: 0x040000B8 RID: 184
private ReadOnlyCollection<Expression> arguments;
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents creating a new array and possibly initializing the elements of the new array.</summary>
// Token: 0x0200002C RID: 44
public sealed class NewArrayExpression : Expression
{
// Token: 0x06000239 RID: 569 RVA: 0x0000BD5C File Offset: 0x00009F5C
internal NewArrayExpression(ExpressionType et, Type type, ReadOnlyCollection<Expression> expressions)
: base(et, type)
{
this.expressions = expressions;
}
/// <summary>Gets the bounds of the array if the value of the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" />, or the values to initialize the elements of the new array if the value of the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" />.</summary>
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent either the bounds of the array or the initialization values.</returns>
// Token: 0x1700002F RID: 47
// (get) Token: 0x0600023A RID: 570 RVA: 0x0000BD70 File Offset: 0x00009F70
public ReadOnlyCollection<Expression> Expressions
{
get
{
return this.expressions;
}
}
// Token: 0x0600023B RID: 571 RVA: 0x0000BD78 File Offset: 0x00009F78
private void EmitNewArrayInit(EmitContext ec, Type type)
{
int count = this.expressions.Count;
ec.ig.Emit(OpCodes.Ldc_I4, count);
ec.ig.Emit(OpCodes.Newarr, type);
for (int i = 0; i < count; i++)
{
ec.ig.Emit(OpCodes.Dup);
ec.ig.Emit(OpCodes.Ldc_I4, i);
this.expressions[i].Emit(ec);
ec.ig.Emit(OpCodes.Stelem, type);
}
}
// Token: 0x0600023C RID: 572 RVA: 0x0000BE0C File Offset: 0x0000A00C
private void EmitNewArrayBounds(EmitContext ec, Type type)
{
int count = this.expressions.Count;
ec.EmitCollection<Expression>(this.expressions);
if (count == 1)
{
ec.ig.Emit(OpCodes.Newarr, type);
return;
}
ec.ig.Emit(OpCodes.Newobj, NewArrayExpression.GetArrayConstructor(type, count));
}
// Token: 0x0600023D RID: 573 RVA: 0x0000BE64 File Offset: 0x0000A064
private static ConstructorInfo GetArrayConstructor(Type type, int rank)
{
return NewArrayExpression.CreateArray(type, rank).GetConstructor(NewArrayExpression.CreateTypeParameters(rank));
}
// Token: 0x0600023E RID: 574 RVA: 0x0000BE78 File Offset: 0x0000A078
private static Type[] CreateTypeParameters(int rank)
{
return Enumerable.Repeat<Type>(typeof(int), rank).ToArray<Type>();
}
// Token: 0x0600023F RID: 575 RVA: 0x0000BE90 File Offset: 0x0000A090
private static Type CreateArray(Type type, int rank)
{
return type.MakeArrayType(rank);
}
// Token: 0x06000240 RID: 576 RVA: 0x0000BE9C File Offset: 0x0000A09C
internal override void Emit(EmitContext ec)
{
Type elementType = base.Type.GetElementType();
ExpressionType nodeType = base.NodeType;
if (nodeType == ExpressionType.NewArrayInit)
{
this.EmitNewArrayInit(ec, elementType);
return;
}
if (nodeType != ExpressionType.NewArrayBounds)
{
throw new NotSupportedException();
}
this.EmitNewArrayBounds(ec, elementType);
}
// Token: 0x040000B9 RID: 185
private ReadOnlyCollection<Expression> expressions;
}
}
@@ -0,0 +1,108 @@
using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents a constructor call.</summary>
// Token: 0x0200002D RID: 45
public sealed class NewExpression : Expression
{
// Token: 0x06000241 RID: 577 RVA: 0x0000BEE8 File Offset: 0x0000A0E8
internal NewExpression(Type type, ReadOnlyCollection<Expression> arguments)
: base(ExpressionType.New, type)
{
this.arguments = arguments;
}
// Token: 0x06000242 RID: 578 RVA: 0x0000BEFC File Offset: 0x0000A0FC
internal NewExpression(ConstructorInfo constructor, ReadOnlyCollection<Expression> arguments, ReadOnlyCollection<MemberInfo> members)
: base(ExpressionType.New, constructor.DeclaringType)
{
this.constructor = constructor;
this.arguments = arguments;
this.members = members;
}
/// <summary>Gets the called constructor.</summary>
/// <returns>The <see cref="T:System.Reflection.ConstructorInfo" /> that represents the called constructor.</returns>
// Token: 0x17000030 RID: 48
// (get) Token: 0x06000243 RID: 579 RVA: 0x0000BF24 File Offset: 0x0000A124
public ConstructorInfo Constructor
{
get
{
return this.constructor;
}
}
/// <summary>Gets the arguments to the constructor.</summary>
/// <returns>A collection of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments to the constructor.</returns>
// Token: 0x17000031 RID: 49
// (get) Token: 0x06000244 RID: 580 RVA: 0x0000BF2C File Offset: 0x0000A12C
public ReadOnlyCollection<Expression> Arguments
{
get
{
return this.arguments;
}
}
/// <summary>Gets the members that can retrieve the values of the fields that were initialized with constructor arguments.</summary>
/// <returns>A collection of <see cref="T:System.Reflection.MemberInfo" /> objects that represent the members that can retrieve the values of the fields that were initialized with constructor arguments.</returns>
// Token: 0x17000032 RID: 50
// (get) Token: 0x06000245 RID: 581 RVA: 0x0000BF34 File Offset: 0x0000A134
public ReadOnlyCollection<MemberInfo> Members
{
get
{
return this.members;
}
}
// Token: 0x06000246 RID: 582 RVA: 0x0000BF3C File Offset: 0x0000A13C
internal override void Emit(EmitContext ec)
{
ILGenerator ig = ec.ig;
Type type = base.Type;
LocalBuilder localBuilder = null;
if (type.IsValueType)
{
localBuilder = ig.DeclareLocal(type);
ig.Emit(OpCodes.Ldloca, localBuilder);
if (this.constructor == null)
{
ig.Emit(OpCodes.Initobj, type);
ig.Emit(OpCodes.Ldloc, localBuilder);
return;
}
}
ec.EmitCollection<Expression>(this.arguments);
if (type.IsValueType)
{
ig.Emit(OpCodes.Call, this.constructor);
ig.Emit(OpCodes.Ldloc, localBuilder);
}
else
{
ig.Emit(OpCodes.Newobj, this.constructor ?? NewExpression.GetDefaultConstructor(type));
}
}
// Token: 0x06000247 RID: 583 RVA: 0x0000BFF4 File Offset: 0x0000A1F4
private static ConstructorInfo GetDefaultConstructor(Type type)
{
return type.GetConstructor(Type.EmptyTypes);
}
// Token: 0x040000BA RID: 186
private ConstructorInfo constructor;
// Token: 0x040000BB RID: 187
private ReadOnlyCollection<Expression> arguments;
// Token: 0x040000BC RID: 188
private ReadOnlyCollection<MemberInfo> members;
}
}
@@ -0,0 +1,70 @@
using System;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents a named parameter expression.</summary>
// Token: 0x0200002E RID: 46
public sealed class ParameterExpression : Expression
{
// Token: 0x06000248 RID: 584 RVA: 0x0000C004 File Offset: 0x0000A204
internal ParameterExpression(Type type, string name)
: base(ExpressionType.Parameter, type)
{
this.name = name;
}
/// <summary>Gets the name of the parameter.</summary>
/// <returns>A <see cref="T:System.String" /> that contains the name of the parameter.</returns>
// Token: 0x17000033 RID: 51
// (get) Token: 0x06000249 RID: 585 RVA: 0x0000C018 File Offset: 0x0000A218
public string Name
{
get
{
return this.name;
}
}
// Token: 0x0600024A RID: 586 RVA: 0x0000C020 File Offset: 0x0000A220
private void EmitLocalParameter(EmitContext ec, int position)
{
ec.ig.Emit(OpCodes.Ldarg, position);
}
// Token: 0x0600024B RID: 587 RVA: 0x0000C034 File Offset: 0x0000A234
private void EmitHoistedLocal(EmitContext ec, int level, int position)
{
ec.EmitScope();
for (int i = 0; i < level; i++)
{
ec.EmitParentScope();
}
ec.EmitLoadLocals();
ec.ig.Emit(OpCodes.Ldc_I4, position);
ec.ig.Emit(OpCodes.Ldelem, typeof(object));
ec.EmitLoadStrongBoxValue(base.Type);
}
// Token: 0x0600024C RID: 588 RVA: 0x0000C09C File Offset: 0x0000A29C
internal override void Emit(EmitContext ec)
{
int num = -1;
if (ec.IsLocalParameter(this, ref num))
{
this.EmitLocalParameter(ec, num);
return;
}
int num2 = 0;
if (ec.IsHoistedLocal(this, ref num2, ref num))
{
this.EmitHoistedLocal(ec, num2, num);
return;
}
throw new InvalidOperationException("Parameter out of scope");
}
// Token: 0x040000BD RID: 189
private string name;
}
}
@@ -0,0 +1,61 @@
using System;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an operation between an expression and a type.</summary>
// Token: 0x0200002F RID: 47
public sealed class TypeBinaryExpression : Expression
{
// Token: 0x0600024D RID: 589 RVA: 0x0000C0E8 File Offset: 0x0000A2E8
internal TypeBinaryExpression(ExpressionType node_type, Expression expression, Type type_operand, Type type)
: base(node_type, type)
{
this.expression = expression;
this.type_operand = type_operand;
}
/// <summary>Gets the expression operand of a type test operation.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression operand of a type test operation.</returns>
// Token: 0x17000034 RID: 52
// (get) Token: 0x0600024E RID: 590 RVA: 0x0000C104 File Offset: 0x0000A304
public Expression Expression
{
get
{
return this.expression;
}
}
/// <summary>Gets the type operand of a type test operation.</summary>
/// <returns>A <see cref="T:System.Type" /> that represents the type operand of a type test operation.</returns>
// Token: 0x17000035 RID: 53
// (get) Token: 0x0600024F RID: 591 RVA: 0x0000C10C File Offset: 0x0000A30C
public Type TypeOperand
{
get
{
return this.type_operand;
}
}
// Token: 0x06000250 RID: 592 RVA: 0x0000C114 File Offset: 0x0000A314
internal override void Emit(EmitContext ec)
{
if (this.expression.Type == typeof(void))
{
ec.ig.Emit(OpCodes.Ldc_I4_0);
return;
}
ec.EmitIsInst(this.expression, this.type_operand);
ec.ig.Emit(OpCodes.Ldnull);
ec.ig.Emit(OpCodes.Cgt_Un);
}
// Token: 0x040000BE RID: 190
private Expression expression;
// Token: 0x040000BF RID: 191
private Type type_operand;
}
}
@@ -0,0 +1,460 @@
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// <summary>Represents an expression that has a unary operator.</summary>
// Token: 0x02000030 RID: 48
public sealed class UnaryExpression : Expression
{
// Token: 0x06000251 RID: 593 RVA: 0x0000C180 File Offset: 0x0000A380
internal UnaryExpression(ExpressionType node_type, Expression operand, Type type)
: base(node_type, type)
{
this.operand = operand;
}
// Token: 0x06000252 RID: 594 RVA: 0x0000C194 File Offset: 0x0000A394
internal UnaryExpression(ExpressionType node_type, Expression operand, Type type, MethodInfo method, bool is_lifted)
: base(node_type, type)
{
this.operand = operand;
this.method = method;
this.is_lifted = is_lifted;
}
/// <summary>Gets the operand of the unary operation.</summary>
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand of the unary operation.</returns>
// Token: 0x17000036 RID: 54
// (get) Token: 0x06000253 RID: 595 RVA: 0x0000C1B8 File Offset: 0x0000A3B8
public Expression Operand
{
get
{
return this.operand;
}
}
/// <summary>Gets the implementing method for the unary operation.</summary>
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</returns>
// Token: 0x17000037 RID: 55
// (get) Token: 0x06000254 RID: 596 RVA: 0x0000C1C0 File Offset: 0x0000A3C0
public MethodInfo Method
{
get
{
return this.method;
}
}
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator.</summary>
/// <returns>true if the node represents a lifted call; otherwise, false.</returns>
// Token: 0x17000038 RID: 56
// (get) Token: 0x06000255 RID: 597 RVA: 0x0000C1C8 File Offset: 0x0000A3C8
public bool IsLifted
{
get
{
return this.is_lifted;
}
}
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type.</summary>
/// <returns>true if the operator's return type is lifted to a nullable type; otherwise, false.</returns>
// Token: 0x17000039 RID: 57
// (get) Token: 0x06000256 RID: 598 RVA: 0x0000C1D0 File Offset: 0x0000A3D0
public bool IsLiftedToNull
{
get
{
return this.is_lifted && base.Type.IsNullable();
}
}
// Token: 0x06000257 RID: 599 RVA: 0x0000C1EC File Offset: 0x0000A3EC
private void EmitArrayLength(EmitContext ec)
{
this.operand.Emit(ec);
ec.ig.Emit(OpCodes.Ldlen);
}
// Token: 0x06000258 RID: 600 RVA: 0x0000C20C File Offset: 0x0000A40C
private void EmitTypeAs(EmitContext ec)
{
Type type = base.Type;
ec.EmitIsInst(this.operand, type);
if (type.IsNullable())
{
ec.ig.Emit(OpCodes.Unbox_Any, type);
}
}
// Token: 0x06000259 RID: 601 RVA: 0x0000C24C File Offset: 0x0000A44C
private void EmitLiftedUnary(EmitContext ec)
{
ILGenerator ig = ec.ig;
LocalBuilder localBuilder = ec.EmitStored(this.operand);
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brtrue, label);
ec.EmitNullableInitialize(localBuilder2);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
ec.EmitNullableGetValueOrDefault(localBuilder);
this.EmitUnaryOperator(ec);
ec.EmitNullableNew(base.Type);
ig.MarkLabel(label2);
}
// Token: 0x0600025A RID: 602 RVA: 0x0000C2DC File Offset: 0x0000A4DC
private void EmitUnaryOperator(EmitContext ec)
{
ILGenerator ig = ec.ig;
ExpressionType nodeType = base.NodeType;
switch (nodeType)
{
case ExpressionType.Negate:
ig.Emit(OpCodes.Neg);
break;
default:
if (nodeType != ExpressionType.Convert && nodeType != ExpressionType.ConvertChecked)
{
if (nodeType == ExpressionType.Not)
{
if (this.operand.Type.GetNotNullableType() == typeof(bool))
{
ig.Emit(OpCodes.Ldc_I4_0);
ig.Emit(OpCodes.Ceq);
}
else
{
ig.Emit(OpCodes.Not);
}
}
}
else
{
this.EmitPrimitiveConversion(ec, this.operand.Type.GetNotNullableType(), base.Type.GetNotNullableType());
}
break;
case ExpressionType.NegateChecked:
ig.Emit(OpCodes.Ldc_I4_M1);
ig.Emit((!Expression.IsUnsigned(this.operand.Type)) ? OpCodes.Mul_Ovf : OpCodes.Mul_Ovf_Un);
break;
}
}
// Token: 0x0600025B RID: 603 RVA: 0x0000C3E4 File Offset: 0x0000A5E4
private void EmitConvert(EmitContext ec)
{
Type type = this.operand.Type;
Type type2 = base.Type;
if (type == type2)
{
this.operand.Emit(ec);
}
else if (type.IsNullable() && !type2.IsNullable())
{
this.EmitConvertFromNullable(ec);
}
else if (!type.IsNullable() && type2.IsNullable())
{
this.EmitConvertToNullable(ec);
}
else if (type.IsNullable() && type2.IsNullable())
{
this.EmitConvertFromNullableToNullable(ec);
}
else if (Expression.IsReferenceConversion(type, type2))
{
this.EmitCast(ec);
}
else
{
if (!Expression.IsPrimitiveConversion(type, type2))
{
throw new NotImplementedException();
}
this.EmitPrimitiveConversion(ec);
}
}
// Token: 0x0600025C RID: 604 RVA: 0x0000C4B8 File Offset: 0x0000A6B8
private void EmitConvertFromNullableToNullable(EmitContext ec)
{
this.EmitLiftedUnary(ec);
}
// Token: 0x0600025D RID: 605 RVA: 0x0000C4C4 File Offset: 0x0000A6C4
private void EmitConvertToNullable(EmitContext ec)
{
ec.Emit(this.operand);
if (this.IsUnBoxing())
{
this.EmitUnbox(ec);
return;
}
if (this.operand.Type != base.Type.GetNotNullableType())
{
this.EmitPrimitiveConversion(ec, this.operand.Type, base.Type.GetNotNullableType());
}
ec.EmitNullableNew(base.Type);
}
// Token: 0x0600025E RID: 606 RVA: 0x0000C534 File Offset: 0x0000A734
private void EmitConvertFromNullable(EmitContext ec)
{
if (this.IsBoxing())
{
ec.Emit(this.operand);
this.EmitBox(ec);
return;
}
ec.EmitCall(this.operand, this.operand.Type.GetMethod("get_Value"));
if (this.operand.Type.GetNotNullableType() != base.Type)
{
this.EmitPrimitiveConversion(ec, this.operand.Type.GetNotNullableType(), base.Type);
}
}
// Token: 0x0600025F RID: 607 RVA: 0x0000C5BC File Offset: 0x0000A7BC
private bool IsBoxing()
{
return this.operand.Type.IsValueType && !base.Type.IsValueType;
}
// Token: 0x06000260 RID: 608 RVA: 0x0000C5F0 File Offset: 0x0000A7F0
private void EmitBox(EmitContext ec)
{
ec.ig.Emit(OpCodes.Box, this.operand.Type);
}
// Token: 0x06000261 RID: 609 RVA: 0x0000C610 File Offset: 0x0000A810
private bool IsUnBoxing()
{
return !this.operand.Type.IsValueType && base.Type.IsValueType;
}
// Token: 0x06000262 RID: 610 RVA: 0x0000C640 File Offset: 0x0000A840
private void EmitUnbox(EmitContext ec)
{
ec.ig.Emit(OpCodes.Unbox_Any, base.Type);
}
// Token: 0x06000263 RID: 611 RVA: 0x0000C658 File Offset: 0x0000A858
private void EmitCast(EmitContext ec)
{
this.operand.Emit(ec);
if (this.IsBoxing())
{
this.EmitBox(ec);
}
else if (this.IsUnBoxing())
{
this.EmitUnbox(ec);
}
else
{
ec.ig.Emit(OpCodes.Castclass, base.Type);
}
}
// Token: 0x06000264 RID: 612 RVA: 0x0000C6B8 File Offset: 0x0000A8B8
private void EmitPrimitiveConversion(EmitContext ec, bool is_unsigned, OpCode signed, OpCode unsigned, OpCode signed_checked, OpCode unsigned_checked)
{
if (base.NodeType != ExpressionType.ConvertChecked)
{
ec.ig.Emit((!is_unsigned) ? signed : unsigned);
}
else
{
ec.ig.Emit((!is_unsigned) ? signed_checked : unsigned_checked);
}
}
// Token: 0x06000265 RID: 613 RVA: 0x0000C70C File Offset: 0x0000A90C
private void EmitPrimitiveConversion(EmitContext ec)
{
this.operand.Emit(ec);
this.EmitPrimitiveConversion(ec, this.operand.Type, base.Type);
}
// Token: 0x06000266 RID: 614 RVA: 0x0000C740 File Offset: 0x0000A940
private void EmitPrimitiveConversion(EmitContext ec, Type from, Type to)
{
bool flag = Expression.IsUnsigned(from);
switch (Type.GetTypeCode(to))
{
case TypeCode.SByte:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I1, OpCodes.Conv_U1, OpCodes.Conv_Ovf_I1, OpCodes.Conv_Ovf_I1_Un);
return;
case TypeCode.Byte:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I1, OpCodes.Conv_U1, OpCodes.Conv_Ovf_U1, OpCodes.Conv_Ovf_U1_Un);
return;
case TypeCode.Int16:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I2, OpCodes.Conv_U2, OpCodes.Conv_Ovf_I2, OpCodes.Conv_Ovf_I2_Un);
return;
case TypeCode.UInt16:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I2, OpCodes.Conv_U2, OpCodes.Conv_Ovf_U2, OpCodes.Conv_Ovf_U2_Un);
return;
case TypeCode.Int32:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I4, OpCodes.Conv_U4, OpCodes.Conv_Ovf_I4, OpCodes.Conv_Ovf_I4_Un);
return;
case TypeCode.UInt32:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I4, OpCodes.Conv_U4, OpCodes.Conv_Ovf_U4, OpCodes.Conv_Ovf_U4_Un);
return;
case TypeCode.Int64:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I8, OpCodes.Conv_U8, OpCodes.Conv_Ovf_I8, OpCodes.Conv_Ovf_I8_Un);
return;
case TypeCode.UInt64:
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I8, OpCodes.Conv_U8, OpCodes.Conv_Ovf_U8, OpCodes.Conv_Ovf_U8_Un);
return;
case TypeCode.Single:
if (flag)
{
ec.ig.Emit(OpCodes.Conv_R_Un);
}
ec.ig.Emit(OpCodes.Conv_R4);
return;
case TypeCode.Double:
if (flag)
{
ec.ig.Emit(OpCodes.Conv_R_Un);
}
ec.ig.Emit(OpCodes.Conv_R8);
return;
default:
throw new NotImplementedException(base.Type.ToString());
}
}
// Token: 0x06000267 RID: 615 RVA: 0x0000C8D8 File Offset: 0x0000AAD8
private void EmitArithmeticUnary(EmitContext ec)
{
if (!this.IsLifted)
{
this.operand.Emit(ec);
this.EmitUnaryOperator(ec);
}
else
{
this.EmitLiftedUnary(ec);
}
}
// Token: 0x06000268 RID: 616 RVA: 0x0000C910 File Offset: 0x0000AB10
private void EmitUserDefinedLiftedToNullOperator(EmitContext ec)
{
ILGenerator ig = ec.ig;
LocalBuilder localBuilder = ec.EmitStored(this.operand);
Label label = ig.DefineLabel();
Label label2 = ig.DefineLabel();
ec.EmitNullableHasValue(localBuilder);
ig.Emit(OpCodes.Brfalse, label);
ec.EmitNullableGetValueOrDefault(localBuilder);
ec.EmitCall(this.method);
ec.EmitNullableNew(base.Type);
ig.Emit(OpCodes.Br, label2);
ig.MarkLabel(label);
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
ec.EmitNullableInitialize(localBuilder2);
ig.MarkLabel(label2);
}
// Token: 0x06000269 RID: 617 RVA: 0x0000C9A4 File Offset: 0x0000ABA4
private void EmitUserDefinedLiftedOperator(EmitContext ec)
{
LocalBuilder localBuilder = ec.EmitStored(this.operand);
ec.EmitNullableGetValue(localBuilder);
ec.EmitCall(this.method);
}
// Token: 0x0600026A RID: 618 RVA: 0x0000C9D4 File Offset: 0x0000ABD4
private void EmitUserDefinedOperator(EmitContext ec)
{
if (!this.IsLifted)
{
ec.Emit(this.operand);
ec.EmitCall(this.method);
}
else if (this.IsLiftedToNull)
{
this.EmitUserDefinedLiftedToNullOperator(ec);
}
else
{
this.EmitUserDefinedLiftedOperator(ec);
}
}
// Token: 0x0600026B RID: 619 RVA: 0x0000CA28 File Offset: 0x0000AC28
private void EmitQuote(EmitContext ec)
{
ec.EmitScope();
ec.EmitReadGlobal(this.operand, typeof(Expression));
if (ec.HasHoistedLocals)
{
ec.EmitLoadHoistedLocalsStore();
}
else
{
ec.ig.Emit(OpCodes.Ldnull);
}
ec.EmitIsolateExpression();
}
// Token: 0x0600026C RID: 620 RVA: 0x0000CA80 File Offset: 0x0000AC80
internal override void Emit(EmitContext ec)
{
if (this.method != null)
{
this.EmitUserDefinedOperator(ec);
return;
}
ExpressionType nodeType = base.NodeType;
switch (nodeType)
{
case ExpressionType.Negate:
case ExpressionType.UnaryPlus:
case ExpressionType.NegateChecked:
case ExpressionType.Not:
this.EmitArithmeticUnary(ec);
return;
default:
if (nodeType == ExpressionType.Convert || nodeType == ExpressionType.ConvertChecked)
{
this.EmitConvert(ec);
return;
}
if (nodeType == ExpressionType.ArrayLength)
{
this.EmitArrayLength(ec);
return;
}
if (nodeType == ExpressionType.Quote)
{
this.EmitQuote(ec);
return;
}
if (nodeType != ExpressionType.TypeAs)
{
throw new NotImplementedException(base.NodeType.ToString());
}
this.EmitTypeAs(ec);
return;
}
}
// Token: 0x040000C0 RID: 192
private Expression operand;
// Token: 0x040000C1 RID: 193
private MethodInfo method;
// Token: 0x040000C2 RID: 194
private bool is_lifted;
}
}