16 [global::__DynamicallyInvokable]
21 private class ExtensionInfo
34 internal class BinaryExpressionProxy
42 public string DebugView => _node.DebugView;
44 public bool IsLifted => _node.IsLifted;
46 public bool IsLiftedToNull => _node.IsLiftedToNull;
64 internal class BlockExpressionProxy
68 public bool CanReduce => _node.CanReduce;
70 public string DebugView => _node.DebugView;
88 internal class CatchBlockProxy
96 public Type Test => _node.Test;
106 internal class ConditionalExpressionProxy
110 public bool CanReduce => _node.CanReduce;
112 public string DebugView => _node.DebugView;
130 internal class ConstantExpressionProxy
134 public bool CanReduce => _node.CanReduce;
136 public string DebugView => _node.DebugView;
142 public object Value => _node.Value;
150 internal class DebugInfoExpressionProxy
154 public bool CanReduce => _node.CanReduce;
156 public string DebugView => _node.DebugView;
160 public int EndColumn => _node.EndColumn;
162 public int EndLine => _node.EndLine;
164 public bool IsClear => _node.IsClear;
168 public int StartColumn => _node.StartColumn;
170 public int StartLine => _node.StartLine;
180 internal class DefaultExpressionProxy
184 public bool CanReduce => _node.CanReduce;
186 public string DebugView => _node.DebugView;
198 internal class DynamicExpressionProxy
206 public bool CanReduce => _node.CanReduce;
208 public string DebugView => _node.DebugView;
210 public Type DelegateType => _node.DelegateType;
222 internal class GotoExpressionProxy
226 public bool CanReduce => _node.CanReduce;
228 public string DebugView => _node.DebugView;
246 internal class IndexExpressionProxy
252 public bool CanReduce => _node.CanReduce;
254 public string DebugView => _node.DebugView;
270 internal class InvocationExpressionProxy
276 public bool CanReduce => _node.CanReduce;
278 public string DebugView => _node.DebugView;
292 internal class LabelExpressionProxy
296 public bool CanReduce => _node.CanReduce;
298 public string DebugView => _node.DebugView;
300 public Expression DefaultValue => _node.DefaultValue;
314 internal class LambdaExpressionProxy
320 public bool CanReduce => _node.CanReduce;
322 public string DebugView => _node.DebugView;
324 public string Name => _node.Name;
330 public Type ReturnType => _node.ReturnType;
332 public bool TailCall => _node.TailCall;
342 internal class ListInitExpressionProxy
346 public bool CanReduce => _node.
CanReduce;
348 public string DebugView => _node.DebugView;
364 internal class LoopExpressionProxy
372 public bool CanReduce => _node.CanReduce;
374 public LabelTarget ContinueLabel => _node.ContinueLabel;
376 public string DebugView => _node.DebugView;
388 internal class MemberExpressionProxy
392 public bool CanReduce => _node.CanReduce;
394 public string DebugView => _node.DebugView;
410 internal class MemberInitExpressionProxy
416 public bool CanReduce => _node.CanReduce;
418 public string DebugView => _node.DebugView;
432 internal class MethodCallExpressionProxy
438 public bool CanReduce => _node.CanReduce;
440 public string DebugView => _node.DebugView;
456 internal class NewArrayExpressionProxy
460 public bool CanReduce => _node.CanReduce;
462 public string DebugView => _node.DebugView;
476 internal class NewExpressionProxy
482 public bool CanReduce => _node.CanReduce;
486 public string DebugView => _node.DebugView;
500 internal class ParameterExpressionProxy
504 public bool CanReduce => _node.CanReduce;
506 public string DebugView => _node.DebugView;
508 public bool IsByRef => _node.IsByRef;
510 public string Name => _node.Name;
522 internal class RuntimeVariablesExpressionProxy
526 public bool CanReduce => _node.CanReduce;
528 public string DebugView => _node.DebugView;
542 internal class SwitchCaseProxy
556 internal class SwitchExpressionProxy
560 public bool CanReduce => _node.CanReduce;
564 public MethodInfo Comparison => _node.Comparison;
566 public string DebugView => _node.DebugView;
568 public Expression DefaultBody => _node.DefaultBody;
572 public Expression SwitchValue => _node.SwitchValue;
582 internal class TryExpressionProxy
588 public bool CanReduce => _node.CanReduce;
590 public string DebugView => _node.DebugView;
608 internal class TypeBinaryExpressionProxy
612 public bool CanReduce => _node.CanReduce;
614 public string DebugView => _node.DebugView;
622 public Type TypeOperand => _node.TypeOperand;
630 internal class UnaryExpressionProxy
634 public bool CanReduce => _node.
CanReduce;
636 public string DebugView => _node.DebugView;
638 public bool IsLifted => _node.IsLifted;
640 public bool IsLiftedToNull => _node.IsLiftedToNull;
656 private static readonly CacheDict<Type, MethodInfo> _LambdaDelegateCache =
new CacheDict<Type, MethodInfo>(40);
658 private static volatile CacheDict<Type, LambdaFactory> _LambdaFactories;
664 [global::__DynamicallyInvokable]
667 [global::__DynamicallyInvokable]
670 if (_legacyCtorSupportTable !=
null && _legacyCtorSupportTable.
TryGetValue(
this, out ExtensionInfo value))
672 return value.NodeType;
674 throw Error.ExtensionNodeMustOverrideProperty(
"Expression.NodeType");
680 [global::__DynamicallyInvokable]
683 [global::__DynamicallyInvokable]
686 if (_legacyCtorSupportTable !=
null && _legacyCtorSupportTable.
TryGetValue(
this, out ExtensionInfo value))
690 throw Error.ExtensionNodeMustOverrideProperty(
"Expression.Type");
696 [global::__DynamicallyInvokable]
697 public virtual bool CanReduce
699 [global::__DynamicallyInvokable]
706 private string DebugView
712 DebugViewWriter.WriteTo(
this, stringWriter);
722 [global::__DynamicallyInvokable]
725 RequiresCanWrite(left,
"left");
726 RequiresCanRead(right,
"right");
727 TypeUtils.ValidateType(left.Type);
728 TypeUtils.ValidateType(right.Type);
729 if (!TypeUtils.AreReferenceAssignable(left.Type, right.Type))
731 throw Error.ExpressionTypeDoesNotMatchAssignment(right.Type, left.Type);
733 return new AssignBinaryExpression(left, right);
738 MethodInfo userDefinedBinaryOperator = GetUserDefinedBinaryOperator(binaryType, left.Type, right.Type, name);
739 if (userDefinedBinaryOperator !=
null)
741 return new MethodBinaryExpression(binaryType, left, right, userDefinedBinaryOperator.
ReturnType, userDefinedBinaryOperator);
743 if (left.Type.IsNullableType() && right.Type.IsNullableType())
745 Type nonNullableType = left.Type.GetNonNullableType();
746 Type nonNullableType2 = right.Type.GetNonNullableType();
747 userDefinedBinaryOperator = GetUserDefinedBinaryOperator(binaryType, nonNullableType, nonNullableType2, name);
750 if ((userDefinedBinaryOperator.
ReturnType != typeof(
bool)) | liftToNull)
752 return new MethodBinaryExpression(binaryType, left, right, TypeUtils.GetNullableType(userDefinedBinaryOperator.
ReturnType), userDefinedBinaryOperator);
754 return new MethodBinaryExpression(binaryType, left, right, typeof(
bool), userDefinedBinaryOperator);
760 private static BinaryExpression GetMethodBasedBinaryOperator(
ExpressionType binaryType, Expression left, Expression right,
MethodInfo method,
bool liftToNull)
762 ValidateOperator(method);
763 ParameterInfo[] parametersCached = method.GetParametersCached();
764 if (parametersCached.Length != 2)
766 throw Error.IncorrectNumberOfMethodCallArguments(method);
768 if (ParameterIsAssignable(parametersCached[0], left.Type) && ParameterIsAssignable(parametersCached[1], right.Type))
770 ValidateParamswithOperandsOrThrow(parametersCached[0].ParameterType, left.Type, binaryType, method.
Name);
771 ValidateParamswithOperandsOrThrow(parametersCached[1].ParameterType, right.Type, binaryType, method.
Name);
772 return new MethodBinaryExpression(binaryType, left, right, method.
ReturnType, method);
774 if (left.Type.IsNullableType() && right.Type.IsNullableType() && ParameterIsAssignable(parametersCached[0], left.Type.GetNonNullableType()) && ParameterIsAssignable(parametersCached[1], right.Type.GetNonNullableType()) && method.
ReturnType.
IsValueType && !method.
ReturnType.IsNullableType())
776 if ((method.
ReturnType != typeof(
bool)) | liftToNull)
778 return new MethodBinaryExpression(binaryType, left, right, TypeUtils.GetNullableType(method.
ReturnType), method);
780 return new MethodBinaryExpression(binaryType, left, right, typeof(
bool), method);
782 throw Error.OperandTypesDoNotMatchParameters(binaryType, method.
Name);
785 private static BinaryExpression GetMethodBasedAssignOperator(
ExpressionType binaryType, Expression left, Expression right,
MethodInfo method, LambdaExpression conversion,
bool liftToNull)
787 BinaryExpression binaryExpression = GetMethodBasedBinaryOperator(binaryType, left, right, method, liftToNull);
788 if (conversion ==
null)
790 if (!TypeUtils.AreReferenceAssignable(left.Type, binaryExpression.Type))
792 throw Error.UserDefinedOpMustHaveValidReturnType(binaryType, binaryExpression.Method.Name);
797 ValidateOpAssignConversionLambda(conversion, binaryExpression.Left, binaryExpression.Method, binaryExpression.NodeType);
798 binaryExpression =
new OpAssignMethodConversionBinaryExpression(binaryExpression.NodeType, binaryExpression.Left, binaryExpression.Right, binaryExpression.Left.Type, binaryExpression.Method, conversion);
800 return binaryExpression;
803 private static BinaryExpression GetUserDefinedBinaryOperatorOrThrow(
ExpressionType binaryType,
string name, Expression left, Expression right,
bool liftToNull)
805 BinaryExpression userDefinedBinaryOperator = GetUserDefinedBinaryOperator(binaryType, name, left, right, liftToNull);
806 if (userDefinedBinaryOperator !=
null)
808 ParameterInfo[] parametersCached = userDefinedBinaryOperator.Method.GetParametersCached();
809 ValidateParamswithOperandsOrThrow(parametersCached[0].ParameterType, left.Type, binaryType, name);
810 ValidateParamswithOperandsOrThrow(parametersCached[1].ParameterType, right.Type, binaryType, name);
811 return userDefinedBinaryOperator;
813 throw Error.BinaryOperatorNotDefined(binaryType, left.Type, right.Type);
816 private static BinaryExpression GetUserDefinedAssignOperatorOrThrow(
ExpressionType binaryType,
string name, Expression left, Expression right, LambdaExpression conversion,
bool liftToNull)
818 BinaryExpression binaryExpression = GetUserDefinedBinaryOperatorOrThrow(binaryType, name, left, right, liftToNull);
819 if (conversion ==
null)
821 if (!TypeUtils.AreReferenceAssignable(left.Type, binaryExpression.Type))
823 throw Error.UserDefinedOpMustHaveValidReturnType(binaryType, binaryExpression.Method.Name);
828 ValidateOpAssignConversionLambda(conversion, binaryExpression.Left, binaryExpression.Method, binaryExpression.NodeType);
829 binaryExpression =
new OpAssignMethodConversionBinaryExpression(binaryExpression.NodeType, binaryExpression.Left, binaryExpression.Right, binaryExpression.Left.Type, binaryExpression.Method, conversion);
831 return binaryExpression;
834 private static MethodInfo GetUserDefinedBinaryOperator(
ExpressionType binaryType, Type leftType, Type rightType,
string name)
841 Type nonNullableType = leftType.GetNonNullableType();
842 Type nonNullableType2 = rightType.GetNonNullableType();
844 MethodInfo methodInfo = nonNullableType.GetMethodValidated(name, bindingAttr,
null, types,
null);
845 if (methodInfo ==
null && !TypeUtils.AreEquivalent(leftType, rightType))
847 methodInfo = nonNullableType2.GetMethodValidated(name, bindingAttr,
null, types,
null);
849 if (IsLiftingConditionalLogicalOperator(leftType, rightType, methodInfo, binaryType))
851 methodInfo = GetUserDefinedBinaryOperator(binaryType, nonNullableType, nonNullableType2, name);
856 private static bool IsLiftingConditionalLogicalOperator(Type left, Type right,
MethodInfo method,
ExpressionType binaryType)
858 if (right.IsNullableType() && left.IsNullableType() && method ==
null)
869 internal static bool ParameterIsAssignable(
ParameterInfo pi, Type argType)
876 return TypeUtils.AreReferenceAssignable(type, argType);
879 private static void ValidateParamswithOperandsOrThrow(Type paramType, Type operandType,
ExpressionType exprType,
string name)
881 if (paramType.IsNullableType() && !operandType.IsNullableType())
883 throw Error.OperandTypesDoNotMatchParameters(exprType, name);
887 private static void ValidateOperator(
MethodInfo method)
889 ValidateMethodInfo(method);
892 throw Error.UserDefinedOperatorMustBeStatic(method);
896 throw Error.UserDefinedOperatorMustNotBeVoid(method);
900 private static void ValidateMethodInfo(
MethodInfo method)
904 throw Error.MethodIsGeneric(method);
908 throw Error.MethodContainsGenericParameters(method);
912 private static bool IsNullComparison(Expression left, Expression right)
914 if (IsNullConstant(left) && !IsNullConstant(right) && right.Type.IsNullableType())
918 if (IsNullConstant(right) && !IsNullConstant(left) && left.Type.IsNullableType())
925 private static bool IsNullConstant(Expression e)
927 ConstantExpression constantExpression = e as ConstantExpression;
928 if (constantExpression !=
null)
930 return constantExpression.Value ==
null;
935 private static void ValidateUserDefinedConditionalLogicOperator(
ExpressionType nodeType, Type left, Type right,
MethodInfo method)
937 ValidateOperator(method);
938 ParameterInfo[] parametersCached = method.GetParametersCached();
939 if (parametersCached.Length != 2)
941 throw Error.IncorrectNumberOfMethodCallArguments(method);
943 if (!ParameterIsAssignable(parametersCached[0], left) && (!left.IsNullableType() || !ParameterIsAssignable(parametersCached[0], left.GetNonNullableType())))
945 throw Error.OperandTypesDoNotMatchParameters(nodeType, method.
Name);
947 if (!ParameterIsAssignable(parametersCached[1], right) && (!right.IsNullableType() || !ParameterIsAssignable(parametersCached[1], right.GetNonNullableType())))
949 throw Error.OperandTypesDoNotMatchParameters(nodeType, method.
Name);
951 if (parametersCached[0].ParameterType != parametersCached[1].ParameterType)
953 throw Error.UserDefinedOpMustHaveConsistentTypes(nodeType, method.
Name);
955 if (method.
ReturnType != parametersCached[0].ParameterType)
957 throw Error.UserDefinedOpMustHaveConsistentTypes(nodeType, method.
Name);
959 if (IsValidLiftedConditionalLogicalOperator(left, right, parametersCached))
961 left = left.GetNonNullableType();
962 right = left.GetNonNullableType();
966 if (booleanOperator ==
null || booleanOperator.
ReturnType != typeof(
bool) || booleanOperator2 ==
null || booleanOperator2.
ReturnType != typeof(
bool))
968 throw Error.LogicalOperatorMustHaveBooleanOperators(nodeType, method.
Name);
970 VerifyOpTrueFalse(nodeType, left, booleanOperator2);
971 VerifyOpTrueFalse(nodeType, left, booleanOperator);
976 ParameterInfo[] parametersCached = opTrue.GetParametersCached();
977 if (parametersCached.Length != 1)
979 throw Error.IncorrectNumberOfMethodCallArguments(opTrue);
981 if (!ParameterIsAssignable(parametersCached[0], left) && (!left.IsNullableType() || !ParameterIsAssignable(parametersCached[0], left.GetNonNullableType())))
983 throw Error.OperandTypesDoNotMatchParameters(nodeType, opTrue.
Name);
987 private static bool IsValidLiftedConditionalLogicalOperator(Type left, Type right,
ParameterInfo[] pms)
989 if (TypeUtils.AreEquivalent(left, right) && right.IsNullableType())
991 return TypeUtils.AreEquivalent(pms[1].ParameterType, right.GetNonNullableType());
1005 [global::__DynamicallyInvokable]
1008 return MakeBinary(binaryType, left, right, liftToNull:
false,
null,
null);
1023 [global::__DynamicallyInvokable]
1026 return MakeBinary(binaryType, left, right, liftToNull, method,
null);
1042 [global::__DynamicallyInvokable]
1048 return Add(left, right, method);
1052 return Subtract(left, right, method);
1056 return Multiply(left, right, method);
1060 return Divide(left, right, method);
1062 return Modulo(left, right, method);
1064 return Power(left, right, method);
1066 return And(left, right, method);
1068 return AndAlso(left, right, method);
1070 return Or(left, right, method);
1072 return OrElse(left, right, method);
1074 return LessThan(left, right, liftToNull, method);
1078 return GreaterThan(left, right, liftToNull, method);
1082 return Equal(left, right, liftToNull, method);
1084 return NotEqual(left, right, liftToNull, method);
1088 return Coalesce(left, right, conversion);
1096 return Assign(left, right);
1098 return AddAssign(left, right, method, conversion);
1100 return AndAssign(left, right, method, conversion);
1112 return OrAssign(left, right, method, conversion);
1114 return PowerAssign(left, right, method, conversion);
1126 throw Error.UnhandledBinary(binaryType);
1137 [global::__DynamicallyInvokable]
1140 return Equal(left, right, liftToNull:
false,
null);
1156 [global::__DynamicallyInvokable]
1159 RequiresCanRead(left,
"left");
1160 RequiresCanRead(right,
"right");
1163 return GetEqualityComparisonOperator(
ExpressionType.Equal,
"op_Equality", left, right, liftToNull);
1165 return GetMethodBasedBinaryOperator(
ExpressionType.Equal, left, right, method, liftToNull);
1172 [global::__DynamicallyInvokable]
1175 RequiresCanRead(left,
"left");
1176 RequiresCanRead(right,
"right");
1177 if (TypeUtils.HasReferenceEquality(left.Type, right.Type))
1179 return new LogicalBinaryExpression(
ExpressionType.Equal, left, right);
1181 throw Error.ReferenceEqualityNotDefined(left.Type, right.Type);
1191 [global::__DynamicallyInvokable]
1194 return NotEqual(left, right, liftToNull:
false,
null);
1210 [global::__DynamicallyInvokable]
1213 RequiresCanRead(left,
"left");
1214 RequiresCanRead(right,
"right");
1217 return GetEqualityComparisonOperator(
ExpressionType.NotEqual,
"op_Inequality", left, right, liftToNull);
1219 return GetMethodBasedBinaryOperator(
ExpressionType.NotEqual, left, right, method, liftToNull);
1226 [global::__DynamicallyInvokable]
1229 RequiresCanRead(left,
"left");
1230 RequiresCanRead(right,
"right");
1231 if (TypeUtils.HasReferenceEquality(left.Type, right.Type))
1233 return new LogicalBinaryExpression(
ExpressionType.NotEqual, left, right);
1235 throw Error.ReferenceEqualityNotDefined(left.Type, right.Type);
1240 if (left.Type == right.Type && (TypeUtils.IsNumeric(left.Type) || left.Type == typeof(
object) || TypeUtils.IsBool(left.Type) || left.Type.GetNonNullableType().IsEnum))
1242 if (left.Type.IsNullableType() && liftToNull)
1244 return new SimpleBinaryExpression(binaryType, left, right, typeof(
bool?));
1246 return new LogicalBinaryExpression(binaryType, left, right);
1248 BinaryExpression userDefinedBinaryOperator = GetUserDefinedBinaryOperator(binaryType, opName, left, right, liftToNull);
1249 if (userDefinedBinaryOperator !=
null)
1251 return userDefinedBinaryOperator;
1253 if (TypeUtils.HasBuiltInEqualityOperator(left.Type, right.Type) || IsNullComparison(left, right))
1255 if (left.Type.IsNullableType() && liftToNull)
1257 return new SimpleBinaryExpression(binaryType, left, right, typeof(
bool?));
1259 return new LogicalBinaryExpression(binaryType, left, right);
1261 throw Error.BinaryOperatorNotDefined(binaryType, left.Type, right.Type);
1271 [global::__DynamicallyInvokable]
1274 return GreaterThan(left, right, liftToNull:
false,
null);
1290 [global::__DynamicallyInvokable]
1293 RequiresCanRead(left,
"left");
1294 RequiresCanRead(right,
"right");
1297 return GetComparisonOperator(
ExpressionType.GreaterThan,
"op_GreaterThan", left, right, liftToNull);
1299 return GetMethodBasedBinaryOperator(
ExpressionType.GreaterThan, left, right, method, liftToNull);
1309 [global::__DynamicallyInvokable]
1312 return LessThan(left, right, liftToNull:
false,
null);
1328 [global::__DynamicallyInvokable]
1331 RequiresCanRead(left,
"left");
1332 RequiresCanRead(right,
"right");
1335 return GetComparisonOperator(
ExpressionType.LessThan,
"op_LessThan", left, right, liftToNull);
1337 return GetMethodBasedBinaryOperator(
ExpressionType.LessThan, left, right, method, liftToNull);
1347 [global::__DynamicallyInvokable]
1366 [global::__DynamicallyInvokable]
1369 RequiresCanRead(left,
"left");
1370 RequiresCanRead(right,
"right");
1373 return GetComparisonOperator(
ExpressionType.GreaterThanOrEqual,
"op_GreaterThanOrEqual", left, right, liftToNull);
1375 return GetMethodBasedBinaryOperator(
ExpressionType.GreaterThanOrEqual, left, right, method, liftToNull);
1385 [global::__DynamicallyInvokable]
1404 [global::__DynamicallyInvokable]
1407 RequiresCanRead(left,
"left");
1408 RequiresCanRead(right,
"right");
1411 return GetComparisonOperator(
ExpressionType.LessThanOrEqual,
"op_LessThanOrEqual", left, right, liftToNull);
1413 return GetMethodBasedBinaryOperator(
ExpressionType.LessThanOrEqual, left, right, method, liftToNull);
1418 if (left.Type == right.Type && TypeUtils.IsNumeric(left.Type))
1420 if (left.Type.IsNullableType() && liftToNull)
1422 return new SimpleBinaryExpression(binaryType, left, right, typeof(
bool?));
1424 return new LogicalBinaryExpression(binaryType, left, right);
1426 return GetUserDefinedBinaryOperatorOrThrow(binaryType, opName, left, right, liftToNull);
1437 [global::__DynamicallyInvokable]
1440 return AndAlso(left, right,
null);
1455 [global::__DynamicallyInvokable]
1458 RequiresCanRead(left,
"left");
1459 RequiresCanRead(right,
"right");
1463 if (left.Type == right.Type)
1465 if (left.Type == typeof(
bool))
1467 return new LogicalBinaryExpression(
ExpressionType.AndAlso, left, right);
1469 if (left.Type == typeof(
bool?))
1471 return new SimpleBinaryExpression(
ExpressionType.AndAlso, left, right, left.Type);
1474 method = GetUserDefinedBinaryOperator(
ExpressionType.AndAlso, left.Type, right.Type,
"op_BitwiseAnd");
1477 ValidateUserDefinedConditionalLogicOperator(
ExpressionType.AndAlso, left.Type, right.Type, method);
1478 type = ((left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.
ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.
ReturnType);
1479 return new MethodBinaryExpression(
ExpressionType.AndAlso, left, right, type, method);
1481 throw Error.BinaryOperatorNotDefined(
ExpressionType.AndAlso, left.Type, right.Type);
1483 ValidateUserDefinedConditionalLogicOperator(
ExpressionType.AndAlso, left.Type, right.Type, method);
1484 type = ((left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.
ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.
ReturnType);
1485 return new MethodBinaryExpression(
ExpressionType.AndAlso, left, right, type, method);
1496 [global::__DynamicallyInvokable]
1499 return OrElse(left, right,
null);
1514 [global::__DynamicallyInvokable]
1517 RequiresCanRead(left,
"left");
1518 RequiresCanRead(right,
"right");
1522 if (left.Type == right.Type)
1524 if (left.Type == typeof(
bool))
1526 return new LogicalBinaryExpression(
ExpressionType.OrElse, left, right);
1528 if (left.Type == typeof(
bool?))
1530 return new SimpleBinaryExpression(
ExpressionType.OrElse, left, right, left.Type);
1533 method = GetUserDefinedBinaryOperator(
ExpressionType.OrElse, left.Type, right.Type,
"op_BitwiseOr");
1536 ValidateUserDefinedConditionalLogicOperator(
ExpressionType.OrElse, left.Type, right.Type, method);
1537 type = ((left.Type.IsNullableType() && method.
ReturnType == left.Type.GetNonNullableType()) ? left.Type : method.
ReturnType);
1538 return new MethodBinaryExpression(
ExpressionType.OrElse, left, right, type, method);
1540 throw Error.BinaryOperatorNotDefined(
ExpressionType.OrElse, left.Type, right.Type);
1542 ValidateUserDefinedConditionalLogicOperator(
ExpressionType.OrElse, left.Type, right.Type, method);
1543 type = ((left.Type.IsNullableType() && method.
ReturnType == left.Type.GetNonNullableType()) ? left.Type : method.
ReturnType);
1544 return new MethodBinaryExpression(
ExpressionType.OrElse, left, right, type, method);
1556 [global::__DynamicallyInvokable]
1559 return Coalesce(left, right,
null);
1573 [global::__DynamicallyInvokable]
1576 RequiresCanRead(left,
"left");
1577 RequiresCanRead(right,
"right");
1578 if (conversion ==
null)
1580 Type type = ValidateCoalesceArgTypes(left.Type, right.Type);
1581 return new SimpleBinaryExpression(
ExpressionType.Coalesce, left, right, type);
1583 if (left.Type.IsValueType && !left.Type.IsNullableType())
1585 throw Error.CoalesceUsedOnNonNullType();
1591 throw Error.UserDefinedOperatorMustNotBeVoid(conversion);
1593 ParameterInfo[] parametersCached = method.GetParametersCached();
1594 if (parametersCached.Length != 1)
1596 throw Error.IncorrectNumberOfMethodCallArguments(conversion);
1598 if (!TypeUtils.AreEquivalent(method.
ReturnType, right.Type))
1600 throw Error.OperandTypesDoNotMatchParameters(
ExpressionType.Coalesce, conversion.ToString());
1602 if (!ParameterIsAssignable(parametersCached[0], left.Type.GetNonNullableType()) && !ParameterIsAssignable(parametersCached[0], left.Type))
1604 throw Error.OperandTypesDoNotMatchParameters(
ExpressionType.Coalesce, conversion.ToString());
1606 return new CoalesceConversionBinaryExpression(left, right, conversion);
1609 private static Type ValidateCoalesceArgTypes(
Type left,
Type right)
1611 Type nonNullableType = left.GetNonNullableType();
1614 throw Error.CoalesceUsedOnNonNullType();
1616 if (left.IsNullableType() && TypeUtils.IsImplicitlyConvertible(right, nonNullableType))
1618 return nonNullableType;
1620 if (TypeUtils.IsImplicitlyConvertible(right, left))
1624 if (TypeUtils.IsImplicitlyConvertible(nonNullableType, right))
1628 throw Error.ArgumentTypesMustMatch();
1638 [global::__DynamicallyInvokable]
1641 return Add(left, right,
null);
1655 [global::__DynamicallyInvokable]
1658 RequiresCanRead(left,
"left");
1659 RequiresCanRead(right,
"right");
1662 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1664 return new SimpleBinaryExpression(
ExpressionType.Add, left, right, left.Type);
1666 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Add,
"op_Addition", left, right, liftToNull:
true);
1668 return GetMethodBasedBinaryOperator(
ExpressionType.Add, left, right, method, liftToNull:
true);
1675 [global::__DynamicallyInvokable]
1678 return AddAssign(left, right,
null,
null);
1686 [global::__DynamicallyInvokable]
1689 return AddAssign(left, right, method,
null);
1698 [global::__DynamicallyInvokable]
1701 RequiresCanRead(left,
"left");
1702 RequiresCanWrite(left,
"left");
1703 RequiresCanRead(right,
"right");
1706 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1708 if (conversion !=
null)
1710 throw Error.ConversionIsNotSupportedForArithmeticTypes();
1712 return new SimpleBinaryExpression(
ExpressionType.AddAssign, left, right, left.Type);
1714 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.AddAssign,
"op_Addition", left, right, conversion, liftToNull:
true);
1716 return GetMethodBasedAssignOperator(
ExpressionType.AddAssign, left, right, method, conversion, liftToNull:
true);
1723 ParameterInfo[] parametersCached = method2.GetParametersCached();
1724 if (parametersCached.Length != 1)
1726 throw Error.IncorrectNumberOfMethodCallArguments(conversion);
1728 if (!TypeUtils.AreEquivalent(method2.
ReturnType, left.Type))
1730 throw Error.OperandTypesDoNotMatchParameters(nodeType, conversion.ToString());
1732 if (method !=
null && !TypeUtils.AreEquivalent(parametersCached[0].ParameterType, method.
ReturnType))
1734 throw Error.OverloadOperatorTypeDoesNotMatchConversionType(nodeType, conversion.ToString());
1742 [global::__DynamicallyInvokable]
1753 [global::__DynamicallyInvokable]
1765 [global::__DynamicallyInvokable]
1768 RequiresCanRead(left,
"left");
1769 RequiresCanWrite(left,
"left");
1770 RequiresCanRead(right,
"right");
1773 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1775 if (conversion !=
null)
1777 throw Error.ConversionIsNotSupportedForArithmeticTypes();
1779 return new SimpleBinaryExpression(
ExpressionType.AddAssignChecked, left, right, left.Type);
1781 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.AddAssignChecked,
"op_Addition", left, right, conversion, liftToNull:
true);
1783 return GetMethodBasedAssignOperator(
ExpressionType.AddAssignChecked, left, right, method, conversion, liftToNull:
true);
1793 [global::__DynamicallyInvokable]
1810 [global::__DynamicallyInvokable]
1813 RequiresCanRead(left,
"left");
1814 RequiresCanRead(right,
"right");
1817 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1819 return new SimpleBinaryExpression(
ExpressionType.AddChecked, left, right, left.Type);
1821 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.AddChecked,
"op_Addition", left, right, liftToNull:
false);
1823 return GetMethodBasedBinaryOperator(
ExpressionType.AddChecked, left, right, method, liftToNull:
true);
1833 [global::__DynamicallyInvokable]
1836 return Subtract(left, right,
null);
1850 [global::__DynamicallyInvokable]
1853 RequiresCanRead(left,
"left");
1854 RequiresCanRead(right,
"right");
1857 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1859 return new SimpleBinaryExpression(
ExpressionType.Subtract, left, right, left.Type);
1861 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Subtract,
"op_Subtraction", left, right, liftToNull:
true);
1863 return GetMethodBasedBinaryOperator(
ExpressionType.Subtract, left, right, method, liftToNull:
true);
1870 [global::__DynamicallyInvokable]
1881 [global::__DynamicallyInvokable]
1893 [global::__DynamicallyInvokable]
1896 RequiresCanRead(left,
"left");
1897 RequiresCanWrite(left,
"left");
1898 RequiresCanRead(right,
"right");
1901 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1903 if (conversion !=
null)
1905 throw Error.ConversionIsNotSupportedForArithmeticTypes();
1907 return new SimpleBinaryExpression(
ExpressionType.SubtractAssign, left, right, left.Type);
1909 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.SubtractAssign,
"op_Subtraction", left, right, conversion, liftToNull:
true);
1911 return GetMethodBasedAssignOperator(
ExpressionType.SubtractAssign, left, right, method, conversion, liftToNull:
true);
1918 [global::__DynamicallyInvokable]
1929 [global::__DynamicallyInvokable]
1941 [global::__DynamicallyInvokable]
1944 RequiresCanRead(left,
"left");
1945 RequiresCanWrite(left,
"left");
1946 RequiresCanRead(right,
"right");
1949 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1951 if (conversion !=
null)
1953 throw Error.ConversionIsNotSupportedForArithmeticTypes();
1955 return new SimpleBinaryExpression(
ExpressionType.SubtractAssignChecked, left, right, left.Type);
1957 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.SubtractAssignChecked,
"op_Subtraction", left, right, conversion, liftToNull:
true);
1959 return GetMethodBasedAssignOperator(
ExpressionType.SubtractAssignChecked, left, right, method, conversion, liftToNull:
true);
1969 [global::__DynamicallyInvokable]
1986 [global::__DynamicallyInvokable]
1989 RequiresCanRead(left,
"left");
1990 RequiresCanRead(right,
"right");
1993 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
1995 return new SimpleBinaryExpression(
ExpressionType.SubtractChecked, left, right, left.Type);
1997 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.SubtractChecked,
"op_Subtraction", left, right, liftToNull:
true);
1999 return GetMethodBasedBinaryOperator(
ExpressionType.SubtractChecked, left, right, method, liftToNull:
true);
2009 [global::__DynamicallyInvokable]
2012 return Divide(left, right,
null);
2026 [global::__DynamicallyInvokable]
2029 RequiresCanRead(left,
"left");
2030 RequiresCanRead(right,
"right");
2033 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2035 return new SimpleBinaryExpression(
ExpressionType.Divide, left, right, left.Type);
2037 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Divide,
"op_Division", left, right, liftToNull:
true);
2039 return GetMethodBasedBinaryOperator(
ExpressionType.Divide, left, right, method, liftToNull:
true);
2046 [global::__DynamicallyInvokable]
2057 [global::__DynamicallyInvokable]
2069 [global::__DynamicallyInvokable]
2072 RequiresCanRead(left,
"left");
2073 RequiresCanWrite(left,
"left");
2074 RequiresCanRead(right,
"right");
2077 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2079 if (conversion !=
null)
2081 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2083 return new SimpleBinaryExpression(
ExpressionType.DivideAssign, left, right, left.Type);
2085 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.DivideAssign,
"op_Division", left, right, conversion, liftToNull:
true);
2087 return GetMethodBasedAssignOperator(
ExpressionType.DivideAssign, left, right, method, conversion, liftToNull:
true);
2097 [global::__DynamicallyInvokable]
2100 return Modulo(left, right,
null);
2114 [global::__DynamicallyInvokable]
2117 RequiresCanRead(left,
"left");
2118 RequiresCanRead(right,
"right");
2121 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2123 return new SimpleBinaryExpression(
ExpressionType.Modulo, left, right, left.Type);
2125 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Modulo,
"op_Modulus", left, right, liftToNull:
true);
2127 return GetMethodBasedBinaryOperator(
ExpressionType.Modulo, left, right, method, liftToNull:
true);
2134 [global::__DynamicallyInvokable]
2145 [global::__DynamicallyInvokable]
2157 [global::__DynamicallyInvokable]
2160 RequiresCanRead(left,
"left");
2161 RequiresCanWrite(left,
"left");
2162 RequiresCanRead(right,
"right");
2165 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2167 if (conversion !=
null)
2169 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2171 return new SimpleBinaryExpression(
ExpressionType.ModuloAssign, left, right, left.Type);
2173 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.ModuloAssign,
"op_Modulus", left, right, conversion, liftToNull:
true);
2175 return GetMethodBasedAssignOperator(
ExpressionType.ModuloAssign, left, right, method, conversion, liftToNull:
true);
2185 [global::__DynamicallyInvokable]
2188 return Multiply(left, right,
null);
2202 [global::__DynamicallyInvokable]
2205 RequiresCanRead(left,
"left");
2206 RequiresCanRead(right,
"right");
2209 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2211 return new SimpleBinaryExpression(
ExpressionType.Multiply, left, right, left.Type);
2213 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Multiply,
"op_Multiply", left, right, liftToNull:
true);
2215 return GetMethodBasedBinaryOperator(
ExpressionType.Multiply, left, right, method, liftToNull:
true);
2222 [global::__DynamicallyInvokable]
2233 [global::__DynamicallyInvokable]
2245 [global::__DynamicallyInvokable]
2248 RequiresCanRead(left,
"left");
2249 RequiresCanWrite(left,
"left");
2250 RequiresCanRead(right,
"right");
2253 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2255 if (conversion !=
null)
2257 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2259 return new SimpleBinaryExpression(
ExpressionType.MultiplyAssign, left, right, left.Type);
2261 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.MultiplyAssign,
"op_Multiply", left, right, conversion, liftToNull:
true);
2263 return GetMethodBasedAssignOperator(
ExpressionType.MultiplyAssign, left, right, method, conversion, liftToNull:
true);
2270 [global::__DynamicallyInvokable]
2281 [global::__DynamicallyInvokable]
2293 [global::__DynamicallyInvokable]
2296 RequiresCanRead(left,
"left");
2297 RequiresCanWrite(left,
"left");
2298 RequiresCanRead(right,
"right");
2301 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2303 if (conversion !=
null)
2305 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2307 return new SimpleBinaryExpression(
ExpressionType.MultiplyAssignChecked, left, right, left.Type);
2309 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.MultiplyAssignChecked,
"op_Multiply", left, right, conversion, liftToNull:
true);
2311 return GetMethodBasedAssignOperator(
ExpressionType.MultiplyAssignChecked, left, right, method, conversion, liftToNull:
true);
2321 [global::__DynamicallyInvokable]
2338 [global::__DynamicallyInvokable]
2341 RequiresCanRead(left,
"left");
2342 RequiresCanRead(right,
"right");
2345 if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type))
2347 return new SimpleBinaryExpression(
ExpressionType.MultiplyChecked, left, right, left.Type);
2349 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.MultiplyChecked,
"op_Multiply", left, right, liftToNull:
true);
2351 return GetMethodBasedBinaryOperator(
ExpressionType.MultiplyChecked, left, right, method, liftToNull:
true);
2354 private static bool IsSimpleShift(
Type left,
Type right)
2356 if (TypeUtils.IsInteger(left))
2358 return right.GetNonNullableType() == typeof(
int);
2363 private static Type GetResultTypeOfShift(
Type left,
Type right)
2365 if (!left.IsNullableType() && right.IsNullableType())
2379 [global::__DynamicallyInvokable]
2396 [global::__DynamicallyInvokable]
2399 RequiresCanRead(left,
"left");
2400 RequiresCanRead(right,
"right");
2403 if (IsSimpleShift(left.Type, right.Type))
2405 Type resultTypeOfShift = GetResultTypeOfShift(left.Type, right.Type);
2406 return new SimpleBinaryExpression(
ExpressionType.LeftShift, left, right, resultTypeOfShift);
2408 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.LeftShift,
"op_LeftShift", left, right, liftToNull:
true);
2410 return GetMethodBasedBinaryOperator(
ExpressionType.LeftShift, left, right, method, liftToNull:
true);
2417 [global::__DynamicallyInvokable]
2428 [global::__DynamicallyInvokable]
2440 [global::__DynamicallyInvokable]
2443 RequiresCanRead(left,
"left");
2444 RequiresCanWrite(left,
"left");
2445 RequiresCanRead(right,
"right");
2448 if (IsSimpleShift(left.Type, right.Type))
2450 if (conversion !=
null)
2452 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2454 Type resultTypeOfShift = GetResultTypeOfShift(left.Type, right.Type);
2455 return new SimpleBinaryExpression(
ExpressionType.LeftShiftAssign, left, right, resultTypeOfShift);
2457 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.LeftShiftAssign,
"op_LeftShift", left, right, conversion, liftToNull:
true);
2459 return GetMethodBasedAssignOperator(
ExpressionType.LeftShiftAssign, left, right, method, conversion, liftToNull:
true);
2469 [global::__DynamicallyInvokable]
2486 [global::__DynamicallyInvokable]
2489 RequiresCanRead(left,
"left");
2490 RequiresCanRead(right,
"right");
2493 if (IsSimpleShift(left.Type, right.Type))
2495 Type resultTypeOfShift = GetResultTypeOfShift(left.Type, right.Type);
2496 return new SimpleBinaryExpression(
ExpressionType.RightShift, left, right, resultTypeOfShift);
2498 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.RightShift,
"op_RightShift", left, right, liftToNull:
true);
2500 return GetMethodBasedBinaryOperator(
ExpressionType.RightShift, left, right, method, liftToNull:
true);
2507 [global::__DynamicallyInvokable]
2518 [global::__DynamicallyInvokable]
2530 [global::__DynamicallyInvokable]
2533 RequiresCanRead(left,
"left");
2534 RequiresCanWrite(left,
"left");
2535 RequiresCanRead(right,
"right");
2538 if (IsSimpleShift(left.Type, right.Type))
2540 if (conversion !=
null)
2542 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2544 Type resultTypeOfShift = GetResultTypeOfShift(left.Type, right.Type);
2545 return new SimpleBinaryExpression(
ExpressionType.RightShiftAssign, left, right, resultTypeOfShift);
2547 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.RightShiftAssign,
"op_RightShift", left, right, conversion, liftToNull:
true);
2549 return GetMethodBasedAssignOperator(
ExpressionType.RightShiftAssign, left, right, method, conversion, liftToNull:
true);
2559 [global::__DynamicallyInvokable]
2562 return And(left, right,
null);
2576 [global::__DynamicallyInvokable]
2579 RequiresCanRead(left,
"left");
2580 RequiresCanRead(right,
"right");
2583 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2585 return new SimpleBinaryExpression(
ExpressionType.And, left, right, left.Type);
2587 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.And,
"op_BitwiseAnd", left, right, liftToNull:
true);
2589 return GetMethodBasedBinaryOperator(
ExpressionType.And, left, right, method, liftToNull:
true);
2596 [global::__DynamicallyInvokable]
2599 return AndAssign(left, right,
null,
null);
2607 [global::__DynamicallyInvokable]
2610 return AndAssign(left, right, method,
null);
2619 [global::__DynamicallyInvokable]
2622 RequiresCanRead(left,
"left");
2623 RequiresCanWrite(left,
"left");
2624 RequiresCanRead(right,
"right");
2627 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2629 if (conversion !=
null)
2631 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2633 return new SimpleBinaryExpression(
ExpressionType.AndAssign, left, right, left.Type);
2635 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.AndAssign,
"op_BitwiseAnd", left, right, conversion, liftToNull:
true);
2637 return GetMethodBasedAssignOperator(
ExpressionType.AndAssign, left, right, method, conversion, liftToNull:
true);
2647 [global::__DynamicallyInvokable]
2650 return Or(left, right,
null);
2664 [global::__DynamicallyInvokable]
2667 RequiresCanRead(left,
"left");
2668 RequiresCanRead(right,
"right");
2671 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2673 return new SimpleBinaryExpression(
ExpressionType.Or, left, right, left.Type);
2675 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.Or,
"op_BitwiseOr", left, right, liftToNull:
true);
2677 return GetMethodBasedBinaryOperator(
ExpressionType.Or, left, right, method, liftToNull:
true);
2684 [global::__DynamicallyInvokable]
2687 return OrAssign(left, right,
null,
null);
2695 [global::__DynamicallyInvokable]
2698 return OrAssign(left, right, method,
null);
2707 [global::__DynamicallyInvokable]
2710 RequiresCanRead(left,
"left");
2711 RequiresCanWrite(left,
"left");
2712 RequiresCanRead(right,
"right");
2715 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2717 if (conversion !=
null)
2719 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2721 return new SimpleBinaryExpression(
ExpressionType.OrAssign, left, right, left.Type);
2723 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.OrAssign,
"op_BitwiseOr", left, right, conversion, liftToNull:
true);
2725 return GetMethodBasedAssignOperator(
ExpressionType.OrAssign, left, right, method, conversion, liftToNull:
true);
2735 [global::__DynamicallyInvokable]
2752 [global::__DynamicallyInvokable]
2755 RequiresCanRead(left,
"left");
2756 RequiresCanRead(right,
"right");
2759 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2761 return new SimpleBinaryExpression(
ExpressionType.ExclusiveOr, left, right, left.Type);
2763 return GetUserDefinedBinaryOperatorOrThrow(
ExpressionType.ExclusiveOr,
"op_ExclusiveOr", left, right, liftToNull:
true);
2765 return GetMethodBasedBinaryOperator(
ExpressionType.ExclusiveOr, left, right, method, liftToNull:
true);
2772 [global::__DynamicallyInvokable]
2783 [global::__DynamicallyInvokable]
2795 [global::__DynamicallyInvokable]
2798 RequiresCanRead(left,
"left");
2799 RequiresCanWrite(left,
"left");
2800 RequiresCanRead(right,
"right");
2803 if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type))
2805 if (conversion !=
null)
2807 throw Error.ConversionIsNotSupportedForArithmeticTypes();
2809 return new SimpleBinaryExpression(
ExpressionType.ExclusiveOrAssign, left, right, left.Type);
2811 return GetUserDefinedAssignOperatorOrThrow(
ExpressionType.ExclusiveOrAssign,
"op_ExclusiveOr", left, right, conversion, liftToNull:
true);
2813 return GetMethodBasedAssignOperator(
ExpressionType.ExclusiveOrAssign, left, right, method, conversion, liftToNull:
true);
2824 [global::__DynamicallyInvokable]
2827 return Power(left, right,
null);
2842 [global::__DynamicallyInvokable]
2845 RequiresCanRead(left,
"left");
2846 RequiresCanRead(right,
"right");
2849 Type typeFromHandle = typeof(
Math);
2853 throw Error.BinaryOperatorNotDefined(
ExpressionType.Power, left.Type, right.Type);
2856 return GetMethodBasedBinaryOperator(
ExpressionType.Power, left, right, method, liftToNull:
true);
2863 [global::__DynamicallyInvokable]
2874 [global::__DynamicallyInvokable]
2886 [global::__DynamicallyInvokable]
2889 RequiresCanRead(left,
"left");
2890 RequiresCanWrite(left,
"left");
2891 RequiresCanRead(right,
"right");
2894 Type typeFromHandle = typeof(
Math);
2898 throw Error.BinaryOperatorNotDefined(
ExpressionType.PowerAssign, left.Type, right.Type);
2901 return GetMethodBasedAssignOperator(
ExpressionType.PowerAssign, left, right, method, conversion, liftToNull:
true);
2914 [global::__DynamicallyInvokable]
2917 RequiresCanRead(array,
"array");
2918 RequiresCanRead(index,
"index");
2919 if (index.Type != typeof(
int))
2921 throw Error.ArgumentMustBeArrayIndexType();
2923 Type type = array.Type;
2926 throw Error.ArgumentMustBeArray();
2930 throw Error.IncorrectNumberOfIndexes();
2939 [global::__DynamicallyInvokable]
2942 RequiresCanRead(arg0,
"arg0");
2943 RequiresCanRead(arg1,
"arg1");
2944 return new Block2(arg0, arg1);
2952 [global::__DynamicallyInvokable]
2955 RequiresCanRead(arg0,
"arg0");
2956 RequiresCanRead(arg1,
"arg1");
2957 RequiresCanRead(arg2,
"arg2");
2958 return new Block3(arg0, arg1, arg2);
2967 [global::__DynamicallyInvokable]
2970 RequiresCanRead(arg0,
"arg0");
2971 RequiresCanRead(arg1,
"arg1");
2972 RequiresCanRead(arg2,
"arg2");
2973 RequiresCanRead(arg3,
"arg3");
2974 return new Block4(arg0, arg1, arg2, arg3);
2984 [global::__DynamicallyInvokable]
2987 RequiresCanRead(arg0,
"arg0");
2988 RequiresCanRead(arg1,
"arg1");
2989 RequiresCanRead(arg2,
"arg2");
2990 RequiresCanRead(arg3,
"arg3");
2991 RequiresCanRead(arg4,
"arg4");
2992 return new Block5(arg0, arg1, arg2, arg3, arg4);
2998 [global::__DynamicallyInvokable]
3001 ContractUtils.RequiresNotNull(expressions,
"expressions");
3002 switch (expressions.Length)
3005 return Block(expressions[0], expressions[1]);
3007 return Block(expressions[0], expressions[1], expressions[2]);
3009 return Block(expressions[0], expressions[1], expressions[2], expressions[3]);
3011 return Block(expressions[0], expressions[1], expressions[2], expressions[3], expressions[4]);
3013 ContractUtils.RequiresNotEmpty(expressions,
"expressions");
3014 RequiresCanRead(expressions,
"expressions");
3015 return new BlockN(expressions.Copy());
3022 [global::__DynamicallyInvokable]
3025 return Block(EmptyReadOnlyCollection<ParameterExpression>.
Instance, expressions);
3032 [global::__DynamicallyInvokable]
3035 ContractUtils.RequiresNotNull(expressions,
"expressions");
3043 [global::__DynamicallyInvokable]
3046 return Block(type, EmptyReadOnlyCollection<ParameterExpression>.
Instance, expressions);
3053 [global::__DynamicallyInvokable]
3064 [global::__DynamicallyInvokable]
3074 [global::__DynamicallyInvokable]
3077 ContractUtils.RequiresNotNull(expressions,
"expressions");
3079 ContractUtils.RequiresNotEmpty(readOnlyCollection,
"expressions");
3080 RequiresCanRead(readOnlyCollection,
"expressions");
3081 return Block(readOnlyCollection.Last().Type, variables, readOnlyCollection);
3089 [global::__DynamicallyInvokable]
3092 ContractUtils.RequiresNotNull(type,
"type");
3093 ContractUtils.RequiresNotNull(expressions,
"expressions");
3096 ContractUtils.RequiresNotEmpty(readOnlyCollection,
"expressions");
3097 RequiresCanRead(readOnlyCollection,
"expressions");
3098 ValidateVariables(readOnlyCollection2,
"variables");
3099 Expression expression = readOnlyCollection.Last();
3100 if (type != typeof(
void) && !TypeUtils.AreReferenceAssignable(type, expression.Type))
3102 throw Error.ArgumentTypesMustMatch();
3104 if (!TypeUtils.AreEquivalent(type, expression.Type))
3106 return new ScopeWithType(readOnlyCollection2, readOnlyCollection, type);
3108 if (readOnlyCollection.
Count == 1)
3110 return new Scope1(readOnlyCollection2, readOnlyCollection[0]);
3112 return new ScopeN(readOnlyCollection2, readOnlyCollection);
3117 if (varList.
Count == 0)
3121 int count = varList.
Count;
3122 Set<ParameterExpression>
set =
new Set<ParameterExpression>(count);
3124 ParameterExpression parameterExpression;
3129 parameterExpression = varList[num];
3130 if (parameterExpression ==
null)
3138 if (parameterExpression.IsByRef)
3140 throw Error.VariableMustNotBeByRef(parameterExpression, parameterExpression.Type);
3142 if (
set.Contains(parameterExpression))
3146 set.Add(parameterExpression);
3152 throw Error.DuplicateVariable(parameterExpression);
3159 [global::__DynamicallyInvokable]
3169 [global::__DynamicallyInvokable]
3172 ContractUtils.RequiresNotNull(variable,
"variable");
3181 [global::__DynamicallyInvokable]
3192 [global::__DynamicallyInvokable]
3195 ContractUtils.RequiresNotNull(variable,
"variable");
3205 [global::__DynamicallyInvokable]
3208 ContractUtils.RequiresNotNull(type,
"type");
3209 ContractUtils.Requires(variable ==
null || TypeUtils.AreEquivalent(variable.
Type, type),
"variable");
3210 if (variable !=
null && variable.
IsByRef)
3212 throw Error.VariableMustNotBeByRef(variable, variable.
Type);
3214 RequiresCanRead(body,
"body");
3217 RequiresCanRead(filter,
"filter");
3218 if (filter.Type != typeof(
bool))
3220 throw Error.ArgumentMustBeBoolean();
3223 return new CatchBlock(type, variable, body, filter);
3236 [global::__DynamicallyInvokable]
3239 RequiresCanRead(test,
"test");
3240 RequiresCanRead(ifTrue,
"ifTrue");
3241 RequiresCanRead(ifFalse,
"ifFalse");
3242 if (test.Type != typeof(
bool))
3244 throw Error.ArgumentMustBeBoolean();
3246 if (!TypeUtils.AreEquivalent(ifTrue.Type, ifFalse.Type))
3248 throw Error.ArgumentTypesMustMatch();
3259 [global::__DynamicallyInvokable]
3262 RequiresCanRead(test,
"test");
3263 RequiresCanRead(ifTrue,
"ifTrue");
3264 RequiresCanRead(ifFalse,
"ifFalse");
3265 ContractUtils.RequiresNotNull(type,
"type");
3266 if (test.Type != typeof(
bool))
3268 throw Error.ArgumentMustBeBoolean();
3270 if (type != typeof(
void) && (!TypeUtils.AreReferenceAssignable(type, ifTrue.Type) || !TypeUtils.AreReferenceAssignable(type, ifFalse.Type)))
3272 throw Error.ArgumentTypesMustMatch();
3281 [global::__DynamicallyInvokable]
3292 [global::__DynamicallyInvokable]
3295 return Condition(test, ifTrue, ifFalse, typeof(
void));
3301 [global::__DynamicallyInvokable]
3304 return ConstantExpression.Make(value, (value ==
null) ? typeof(
object) : value.GetType());
3315 [global::__DynamicallyInvokable]
3318 ContractUtils.RequiresNotNull(type,
"type");
3319 if (value ==
null && type.
IsValueType && !type.IsNullableType())
3321 throw Error.ArgumentTypesMustMatch();
3325 throw Error.ArgumentTypesMustMatch();
3337 [global::__DynamicallyInvokable]
3340 ContractUtils.RequiresNotNull(document,
"document");
3341 if (startLine == 16707566 && startColumn == 0 && endLine == 16707566 && endColumn == 0)
3343 return new ClearDebugInfoExpression(document);
3345 ValidateSpan(startLine, startColumn, endLine, endColumn);
3346 return new SpanDebugInfoExpression(document, startLine, startColumn, endLine, endColumn);
3352 [global::__DynamicallyInvokable]
3355 ContractUtils.RequiresNotNull(document,
"document");
3356 return new ClearDebugInfoExpression(document);
3359 private static void ValidateSpan(
int startLine,
int startColumn,
int endLine,
int endColumn)
3363 throw Error.OutOfRange(
"startLine", 1);
3365 if (startColumn < 1)
3367 throw Error.OutOfRange(
"startColumn", 1);
3371 throw Error.OutOfRange(
"endLine", 1);
3375 throw Error.OutOfRange(
"endColumn", 1);
3377 if (startLine > endLine)
3379 throw Error.StartEndMustBeOrdered();
3381 if (startLine == endLine && startColumn > endColumn)
3383 throw Error.StartEndMustBeOrdered();
3389 [global::__DynamicallyInvokable]
3398 [global::__DynamicallyInvokable]
3401 if (type == typeof(
void))
3413 [global::__DynamicallyInvokable]
3424 [global::__DynamicallyInvokable]
3427 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
3428 ContractUtils.RequiresNotNull(binder,
"binder");
3431 throw Error.TypeMustBeDerivedFromSystemDelegate();
3433 MethodInfo validMethodForDynamic = GetValidMethodForDynamic(delegateType);
3435 ValidateArgumentTypes(validMethodForDynamic,
ExpressionType.Dynamic, ref arguments2);
3436 return DynamicExpression.Make(validMethodForDynamic.GetReturnType(), delegateType, binder, arguments2);
3444 [global::__DynamicallyInvokable]
3447 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
3448 ContractUtils.RequiresNotNull(binder,
"binder");
3451 throw Error.TypeMustBeDerivedFromSystemDelegate();
3453 MethodInfo validMethodForDynamic = GetValidMethodForDynamic(delegateType);
3454 ParameterInfo[] parametersCached = validMethodForDynamic.GetParametersCached();
3455 ValidateArgumentCount(validMethodForDynamic,
ExpressionType.Dynamic, 2, parametersCached);
3456 ValidateDynamicArgument(arg0);
3457 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg0, parametersCached[1]);
3458 return DynamicExpression.Make(validMethodForDynamic.GetReturnType(), delegateType, binder, arg0);
3467 [global::__DynamicallyInvokable]
3470 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
3471 ContractUtils.RequiresNotNull(binder,
"binder");
3474 throw Error.TypeMustBeDerivedFromSystemDelegate();
3476 MethodInfo validMethodForDynamic = GetValidMethodForDynamic(delegateType);
3477 ParameterInfo[] parametersCached = validMethodForDynamic.GetParametersCached();
3478 ValidateArgumentCount(validMethodForDynamic,
ExpressionType.Dynamic, 3, parametersCached);
3479 ValidateDynamicArgument(arg0);
3480 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg0, parametersCached[1]);
3481 ValidateDynamicArgument(arg1);
3482 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg1, parametersCached[2]);
3483 return DynamicExpression.Make(validMethodForDynamic.GetReturnType(), delegateType, binder, arg0, arg1);
3493 [global::__DynamicallyInvokable]
3496 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
3497 ContractUtils.RequiresNotNull(binder,
"binder");
3500 throw Error.TypeMustBeDerivedFromSystemDelegate();
3502 MethodInfo validMethodForDynamic = GetValidMethodForDynamic(delegateType);
3503 ParameterInfo[] parametersCached = validMethodForDynamic.GetParametersCached();
3504 ValidateArgumentCount(validMethodForDynamic,
ExpressionType.Dynamic, 4, parametersCached);
3505 ValidateDynamicArgument(arg0);
3506 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg0, parametersCached[1]);
3507 ValidateDynamicArgument(arg1);
3508 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg1, parametersCached[2]);
3509 ValidateDynamicArgument(arg2);
3510 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg2, parametersCached[3]);
3511 return DynamicExpression.Make(validMethodForDynamic.GetReturnType(), delegateType, binder, arg0, arg1, arg2);
3522 [global::__DynamicallyInvokable]
3525 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
3526 ContractUtils.RequiresNotNull(binder,
"binder");
3529 throw Error.TypeMustBeDerivedFromSystemDelegate();
3531 MethodInfo validMethodForDynamic = GetValidMethodForDynamic(delegateType);
3532 ParameterInfo[] parametersCached = validMethodForDynamic.GetParametersCached();
3533 ValidateArgumentCount(validMethodForDynamic,
ExpressionType.Dynamic, 5, parametersCached);
3534 ValidateDynamicArgument(arg0);
3535 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg0, parametersCached[1]);
3536 ValidateDynamicArgument(arg1);
3537 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg1, parametersCached[2]);
3538 ValidateDynamicArgument(arg2);
3539 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg2, parametersCached[3]);
3540 ValidateDynamicArgument(arg3);
3541 ValidateOneArgument(validMethodForDynamic,
ExpressionType.Dynamic, arg3, parametersCached[4]);
3542 return DynamicExpression.Make(validMethodForDynamic.GetReturnType(), delegateType, binder, arg0, arg1, arg2, arg3);
3545 private static MethodInfo GetValidMethodForDynamic(
Type delegateType)
3548 ParameterInfo[] parametersCached = method.GetParametersCached();
3551 throw Error.FirstArgumentMustBeCallSite();
3561 [global::__DynamicallyInvokable]
3572 [global::__DynamicallyInvokable]
3575 ContractUtils.RequiresNotNull(binder,
"binder");
3576 ValidateDynamicArgument(arg0);
3577 DelegateHelpers.TypeInfo nextTypeInfo = DelegateHelpers.GetNextTypeInfo(returnType, DelegateHelpers.GetNextTypeInfo(arg0.Type, DelegateHelpers.NextTypeInfo(typeof(
CallSite))));
3578 Type type = nextTypeInfo.DelegateType;
3581 type = nextTypeInfo.MakeDelegateType(returnType, arg0);
3592 [global::__DynamicallyInvokable]
3595 ContractUtils.RequiresNotNull(binder,
"binder");
3596 ValidateDynamicArgument(arg0);
3597 ValidateDynamicArgument(arg1);
3598 DelegateHelpers.TypeInfo nextTypeInfo = DelegateHelpers.GetNextTypeInfo(returnType, DelegateHelpers.GetNextTypeInfo(arg1.Type, DelegateHelpers.GetNextTypeInfo(arg0.Type, DelegateHelpers.NextTypeInfo(typeof(
CallSite)))));
3599 Type type = nextTypeInfo.DelegateType;
3602 type = nextTypeInfo.MakeDelegateType(returnType, arg0, arg1);
3614 [global::__DynamicallyInvokable]
3617 ContractUtils.RequiresNotNull(binder,
"binder");
3618 ValidateDynamicArgument(arg0);
3619 ValidateDynamicArgument(arg1);
3620 ValidateDynamicArgument(arg2);
3621 DelegateHelpers.TypeInfo nextTypeInfo = DelegateHelpers.GetNextTypeInfo(returnType, DelegateHelpers.GetNextTypeInfo(arg2.Type, DelegateHelpers.GetNextTypeInfo(arg1.Type, DelegateHelpers.GetNextTypeInfo(arg0.Type, DelegateHelpers.NextTypeInfo(typeof(
CallSite))))));
3622 Type type = nextTypeInfo.DelegateType;
3625 type = nextTypeInfo.MakeDelegateType(returnType, arg0, arg1, arg2);
3638 [global::__DynamicallyInvokable]
3641 ContractUtils.RequiresNotNull(binder,
"binder");
3642 ValidateDynamicArgument(arg0);
3643 ValidateDynamicArgument(arg1);
3644 ValidateDynamicArgument(arg2);
3645 ValidateDynamicArgument(arg3);
3646 DelegateHelpers.TypeInfo nextTypeInfo = DelegateHelpers.GetNextTypeInfo(returnType, DelegateHelpers.GetNextTypeInfo(arg3.Type, DelegateHelpers.GetNextTypeInfo(arg2.Type, DelegateHelpers.GetNextTypeInfo(arg1.Type, DelegateHelpers.GetNextTypeInfo(arg0.Type, DelegateHelpers.NextTypeInfo(typeof(
CallSite)))))));
3647 Type type = nextTypeInfo.DelegateType;
3650 type = nextTypeInfo.MakeDelegateType(returnType, arg0, arg1, arg2, arg3);
3652 return DynamicExpression.Make(returnType, type, binder, arg0, arg1, arg2, arg3);
3660 [global::__DynamicallyInvokable]
3663 ContractUtils.RequiresNotNull(arguments,
"arguments");
3664 ContractUtils.RequiresNotNull(returnType,
"returnType");
3666 ContractUtils.RequiresNotEmpty(readOnlyCollection,
"args");
3667 return MakeDynamic(binder, returnType, readOnlyCollection);
3672 ContractUtils.RequiresNotNull(binder,
"binder");
3673 for (
int i = 0; i < args.
Count; i++)
3676 ValidateDynamicArgument(arg);
3678 Type delegateType = DelegateHelpers.MakeCallSiteDelegate(args, returnType);
3682 return DynamicExpression.Make(returnType, delegateType, binder, args[0]);
3684 return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1]);
3686 return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1], args[2]);
3688 return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1], args[2], args[3]);
3690 return DynamicExpression.Make(returnType, delegateType, binder, args);
3694 private static void ValidateDynamicArgument(Expression arg)
3696 RequiresCanRead(arg,
"arguments");
3697 Type type = arg.Type;
3698 ContractUtils.RequiresNotNull(type,
"type");
3699 TypeUtils.ValidateType(type);
3700 if (type == typeof(
void))
3702 throw Error.ArgumentTypeCannotBeVoid();
3713 [global::__DynamicallyInvokable]
3727 [global::__DynamicallyInvokable]
3730 ContractUtils.RequiresNotNull(addMethod,
"addMethod");
3731 ContractUtils.RequiresNotNull(arguments,
"arguments");
3733 RequiresCanRead(arguments2,
"arguments");
3734 ValidateElementInitAddMethodInfo(addMethod);
3735 ValidateArgumentTypes(addMethod,
ExpressionType.Call, ref arguments2);
3739 private static void ValidateElementInitAddMethodInfo(
MethodInfo addMethod)
3741 ValidateMethodInfo(addMethod);
3742 ParameterInfo[] parametersCached = addMethod.GetParametersCached();
3743 if (parametersCached.Length == 0)
3745 throw Error.ElementInitializerMethodWithZeroArgs();
3749 throw Error.ElementInitializerMethodNotAdd();
3753 throw Error.ElementInitializerMethodStatic();
3760 if (num < array.Length)
3762 parameterInfo = array[num];
3772 throw Error.ElementInitializerMethodNoRefOutParam(parameterInfo.
Name, addMethod.
Name);
3778 [Obsolete(
"use a different constructor that does not take ExpressionType. Then override NodeType and Type properties to provide the values that would be specified to this constructor.")]
3781 if (_legacyCtorSupportTable ==
null)
3785 _legacyCtorSupportTable.
Add(
this,
new ExtensionInfo(nodeType, type));
3789 [global::__DynamicallyInvokable]
3796 [global::__DynamicallyInvokable]
3801 throw Error.ReducibleMustOverrideReduce();
3809 [global::__DynamicallyInvokable]
3814 throw Error.MustBeReducible();
3822 [global::__DynamicallyInvokable]
3830 [global::__DynamicallyInvokable]
3835 throw Error.MustBeReducible();
3838 if (expression ==
null || expression ==
this)
3840 throw Error.MustReduceToDifferent();
3842 if (!TypeUtils.AreReferenceAssignable(
Type, expression.Type))
3844 throw Error.ReducedNotCompatible();
3851 [global::__DynamicallyInvokable]
3857 expression = expression.ReduceAndCheck();
3864 [global::__DynamicallyInvokable]
3867 return ExpressionStringBuilder.ExpressionToString(
this);
3874 if (readOnlyCollection !=
null)
3876 return readOnlyCollection;
3884 Expression expression = collection as Expression;
3885 if (expression !=
null)
3892 internal static T ReturnObject<T>(
object collectionOrT) where
T :
class 3894 T val = collectionOrT as
T;
3902 private static void RequiresCanRead(Expression expression,
string paramName)
3904 if (expression ==
null)
3906 throw new ArgumentNullException(paramName);
3908 switch (expression.NodeType)
3912 IndexExpression indexExpression = (IndexExpression)expression;
3913 if (indexExpression.Indexer !=
null && !indexExpression.Indexer.CanRead)
3915 throw new ArgumentException(Strings.ExpressionMustBeReadable, paramName);
3921 MemberExpression memberExpression = (MemberExpression)expression;
3928 throw new ArgumentException(Strings.ExpressionMustBeReadable, paramName);
3945 for (
int i = 0; i < list.Count; i++)
3947 RequiresCanRead(list[i], paramName);
3952 foreach (Expression item
in items)
3954 RequiresCanRead(item, paramName);
3959 private static void RequiresCanWrite(Expression expression,
string paramName)
3961 if (expression ==
null)
3963 throw new ArgumentNullException(paramName);
3966 switch (expression.NodeType)
3970 IndexExpression indexExpression = (IndexExpression)expression;
3971 flag = (!(indexExpression.Indexer !=
null) || indexExpression.Indexer.CanWrite);
3976 MemberExpression memberExpression = (MemberExpression)expression;
3977 switch (memberExpression.Member.MemberType)
4000 throw new ArgumentException(Strings.ExpressionMustBeWriteable, paramName);
4007 [global::__DynamicallyInvokable]
4017 [global::__DynamicallyInvokable]
4027 [global::__DynamicallyInvokable]
4038 [global::__DynamicallyInvokable]
4047 [global::__DynamicallyInvokable]
4057 [global::__DynamicallyInvokable]
4066 [global::__DynamicallyInvokable]
4076 [global::__DynamicallyInvokable]
4086 [global::__DynamicallyInvokable]
4097 [global::__DynamicallyInvokable]
4106 [global::__DynamicallyInvokable]
4116 [global::__DynamicallyInvokable]
4126 [global::__DynamicallyInvokable]
4137 [global::__DynamicallyInvokable]
4149 [global::__DynamicallyInvokable]
4152 ValidateGoto(target, ref value,
"target",
"value");
4156 private static void ValidateGoto(
LabelTarget target, ref
Expression value,
string targetParameter,
string valueParameter)
4158 ContractUtils.RequiresNotNull(target, targetParameter);
4161 if (target.
Type != typeof(
void))
4163 throw Error.LabelMustBeVoidOrHaveExpression();
4168 ValidateGotoType(target.
Type, ref value, valueParameter);
4172 private static void ValidateGotoType(Type expectedType, ref Expression value,
string paramName)
4174 RequiresCanRead(value, paramName);
4175 if (expectedType != typeof(
void) && !TypeUtils.AreReferenceAssignable(expectedType, value.Type) && !TryQuote(expectedType, ref value))
4177 throw Error.ExpressionTypeDoesNotMatchLabel(value.Type, expectedType);
4186 [global::__DynamicallyInvokable]
4189 if (indexer !=
null)
4191 return Property(instance, indexer, arguments);
4200 [global::__DynamicallyInvokable]
4210 [global::__DynamicallyInvokable]
4213 RequiresCanRead(array,
"array");
4214 Type type = array.Type;
4217 throw Error.ArgumentMustBeArray();
4222 throw Error.IncorrectNumberOfIndexes();
4224 foreach (
Expression item
in readOnlyCollection)
4226 RequiresCanRead(item,
"indexes");
4227 if (item.Type != typeof(
int))
4229 throw Error.ArgumentMustBeArrayIndexType();
4240 [global::__DynamicallyInvokable]
4243 RequiresCanRead(instance,
"instance");
4244 ContractUtils.RequiresNotNull(propertyName,
"indexerName");
4245 PropertyInfo indexer = FindInstanceProperty(instance.Type, propertyName, arguments);
4246 return Property(instance, indexer, arguments);
4252 PropertyInfo propertyInfo = FindProperty(type, propertyName, arguments, flags);
4253 if (propertyInfo ==
null)
4256 propertyInfo = FindProperty(type, propertyName, arguments, flags);
4258 if (propertyInfo ==
null)
4260 if (arguments ==
null || arguments.Length == 0)
4262 throw Error.InstancePropertyWithoutParameterNotDefinedForType(propertyName, type);
4264 throw Error.InstancePropertyWithSpecifiedParametersNotDefinedForType(propertyName, GetArgTypesString(arguments), type);
4266 return propertyInfo;
4269 private static string GetArgTypesString(Expression[] arguments)
4273 stringBuilder.
Append(
"(");
4274 foreach (Type item
in from arg
in arguments
4279 stringBuilder.
Append(
", ");
4281 stringBuilder.
Append(item.Name);
4284 stringBuilder.
Append(
")");
4288 private static PropertyInfo FindProperty(Type type,
string propertyName, Expression[] arguments,
BindingFlags flags)
4291 if (array ==
null || array.Length == 0)
4297 int num = FindBestProperty(properties, arguments, out property);
4304 throw Error.PropertyWithMoreThanOneMatch(propertyName, type);
4315 if (property2 !=
null && IsCompatible(property2, args))
4317 if (property ==
null)
4319 property = property2;
4331 private static bool IsCompatible(
PropertyInfo pi, Expression[] args)
4335 if (methodInfo !=
null)
4337 array = methodInfo.GetParametersCached();
4342 array = methodInfo.GetParametersCached().RemoveLast();
4344 if (methodInfo ==
null)
4350 return array.Length == 0;
4352 if (array.Length != args.Length)
4356 for (
int i = 0; i < args.Length; i++)
4358 if (args[i] ==
null)
4362 if (!TypeUtils.AreReferenceAssignable(array[i].ParameterType, args[i].Type))
4375 [global::__DynamicallyInvokable]
4386 [global::__DynamicallyInvokable]
4390 ValidateIndexedProperty(instance, indexer, ref argList);
4396 ContractUtils.RequiresNotNull(property,
"property");
4399 throw Error.PropertyCannotHaveRefType();
4403 throw Error.PropertyTypeCannotBeVoid();
4406 MethodInfo getMethod =
property.GetGetMethod(nonPublic:
true);
4407 if (getMethod !=
null)
4409 array = getMethod.GetParametersCached();
4410 ValidateAccessor(instance, getMethod, array, ref argList);
4412 MethodInfo setMethod =
property.GetSetMethod(nonPublic:
true);
4413 if (setMethod !=
null)
4415 ParameterInfo[] parametersCached = setMethod.GetParametersCached();
4416 if (parametersCached.Length == 0)
4418 throw Error.SetterHasNoParams();
4420 Type parameterType = parametersCached[parametersCached.Length - 1].
ParameterType;
4421 if (parameterType.IsByRef)
4423 throw Error.PropertyCannotHaveRefType();
4427 throw Error.SetterMustBeVoid();
4431 throw Error.PropertyTyepMustMatchSetter();
4433 if (getMethod !=
null)
4437 throw Error.BothAccessorsMustBeStatic();
4439 if (array.Length != parametersCached.Length - 1)
4441 throw Error.IndexesOfSetGetMustMatch();
4443 for (
int i = 0; i < array.Length; i++)
4445 if (array[i].ParameterType != parametersCached[i].ParameterType)
4447 throw Error.IndexesOfSetGetMustMatch();
4453 ValidateAccessor(instance, setMethod, parametersCached.RemoveLast(), ref argList);
4456 if (getMethod ==
null && setMethod ==
null)
4458 throw Error.PropertyDoesNotHaveAccessor(property);
4464 ContractUtils.RequiresNotNull(arguments,
"arguments");
4465 ValidateMethodInfo(method);
4468 throw Error.AccessorsCannotHaveVarArgs();
4472 if (instance !=
null)
4474 throw Error.OnlyStaticMethodsHaveNullInstance();
4479 if (instance ==
null)
4481 throw Error.OnlyStaticMethodsHaveNullInstance();
4483 RequiresCanRead(instance,
"instance");
4484 ValidateCallInstanceType(instance.Type, method);
4486 ValidateAccessorArgumentTypes(method, indexes, ref arguments);
4491 if (indexes.Length != 0)
4493 if (indexes.Length != arguments.Count)
4495 throw Error.IncorrectNumberOfMethodCallArguments(method);
4497 Expression[] array =
null;
4499 for (
int num = indexes.Length; i < num; i++)
4501 Expression argument = arguments[i];
4503 RequiresCanRead(argument,
"arguments");
4505 if (parameterType.IsByRef)
4507 throw Error.AccessorsCannotHaveByRefArgs();
4509 TypeUtils.ValidateType(parameterType);
4510 if (!TypeUtils.AreReferenceAssignable(parameterType, argument.Type) && !TryQuote(parameterType, ref argument))
4512 throw Error.ExpressionTypeDoesNotMatchMethodParameter(argument.Type, parameterType, method);
4514 if (array ==
null && argument != arguments[i])
4516 array =
new Expression[arguments.Count];
4517 for (
int j = 0; j < i; j++)
4519 array[j] = arguments[j];
4524 array[i] = argument;
4529 arguments =
new TrueReadOnlyCollection<Expression>(array);
4532 else if (arguments.Count > 0)
4534 throw Error.IncorrectNumberOfMethodCallArguments(method);
4548 [global::__DynamicallyInvokable]
4564 [global::__DynamicallyInvokable]
4567 RequiresCanRead(expression,
"expression");
4569 MethodInfo invokeMethod = GetInvokeMethod(expression);
4570 ValidateArgumentTypes(invokeMethod,
ExpressionType.Invoke, ref arguments2);
4576 Type type = expression.Type;
4579 Type type2 = TypeUtils.FindGenericType(typeof(
Expression<>), expression.Type);
4582 throw Error.ExpressionTypeNotInvocable(expression.Type);
4592 [global::__DynamicallyInvokable]
4595 return Label(target,
null);
4602 [global::__DynamicallyInvokable]
4605 ValidateGoto(target, ref defaultValue,
"label",
"defaultValue");
4611 [global::__DynamicallyInvokable]
4614 return Label(typeof(
void),
null);
4620 [global::__DynamicallyInvokable]
4623 return Label(typeof(
void), name);
4629 [global::__DynamicallyInvokable]
4632 return Label(type,
null);
4639 [global::__DynamicallyInvokable]
4642 ContractUtils.RequiresNotNull(type,
"type");
4643 TypeUtils.ValidateType(type);
4649 CacheDict<Type, LambdaFactory> cacheDict = _LambdaFactories;
4650 if (cacheDict ==
null)
4652 cacheDict = (_LambdaFactories =
new CacheDict<Type, LambdaFactory>(50));
4655 if (!cacheDict.TryGetValue(delegateType, out LambdaFactory value))
4657 methodInfo = typeof(Expression<>).MakeGenericType(delegateType).GetMethod(
"Create",
BindingFlags.Static |
BindingFlags.NonPublic);
4658 if (delegateType.CanCache())
4660 value = (cacheDict[delegateType] = (LambdaFactory)
Delegate.
CreateDelegate(typeof(LambdaFactory), methodInfo));
4665 return value(body, name, tailCall, parameters);
4667 return (LambdaExpression)methodInfo.Invoke(
null,
new object[4]
4687 [global::__DynamicallyInvokable]
4699 [global::__DynamicallyInvokable]
4716 [global::__DynamicallyInvokable]
4719 return Lambda<TDelegate>(body,
null, tailCall:
false, parameters);
4728 [global::__DynamicallyInvokable]
4731 return Lambda<TDelegate>(body,
null, tailCall, parameters);
4740 [global::__DynamicallyInvokable]
4743 return Lambda<TDelegate>(body, name, tailCall:
false, parameters);
4753 [global::__DynamicallyInvokable]
4757 ValidateLambdaArgs(typeof(TDelegate), ref body, parameters2);
4769 [global::__DynamicallyInvokable]
4780 [global::__DynamicallyInvokable]
4790 [global::__DynamicallyInvokable]
4793 return Lambda(body,
null, tailCall:
false, parameters);
4801 [global::__DynamicallyInvokable]
4804 return Lambda(body,
null, tailCall, parameters);
4818 [global::__DynamicallyInvokable]
4821 return Lambda(delegateType, body,
null, tailCall:
false, parameters);
4830 [global::__DynamicallyInvokable]
4833 return Lambda(delegateType, body,
null, tailCall, parameters);
4847 [global::__DynamicallyInvokable]
4850 return Lambda(delegateType, body,
null, tailCall:
false, parameters);
4859 [global::__DynamicallyInvokable]
4862 return Lambda(delegateType, body,
null, tailCall, parameters);
4870 [global::__DynamicallyInvokable]
4873 return Lambda(body, name, tailCall:
false, parameters);
4882 [global::__DynamicallyInvokable]
4885 ContractUtils.RequiresNotNull(body,
"body");
4887 int count = readOnlyCollection.
Count;
4888 Type[] array =
new Type[count + 1];
4891 Set<ParameterExpression>
set =
new Set<ParameterExpression>(readOnlyCollection.
Count);
4892 for (
int i = 0; i < count; i++)
4895 ContractUtils.RequiresNotNull(parameterExpression,
"parameter");
4897 if (
set.Contains(parameterExpression))
4899 throw Error.DuplicateVariable(parameterExpression);
4901 set.Add(parameterExpression);
4904 array[count] = body.Type;
4905 Type delegateType = DelegateHelpers.MakeDelegateType(array);
4906 return CreateLambda(delegateType, body, name, tailCall, readOnlyCollection);
4915 [global::__DynamicallyInvokable]
4919 ValidateLambdaArgs(delegateType, ref body, parameters2);
4920 return CreateLambda(delegateType, body, name, tailCall:
false, parameters2);
4930 [global::__DynamicallyInvokable]
4934 ValidateLambdaArgs(delegateType, ref body, parameters2);
4935 return CreateLambda(delegateType, body, name, tailCall, parameters2);
4940 ContractUtils.RequiresNotNull(delegateType,
"delegateType");
4941 RequiresCanRead(body,
"body");
4944 throw Error.LambdaTypeMustBeDerivedFromSystemDelegate();
4946 CacheDict<Type, MethodInfo> lambdaDelegateCache = _LambdaDelegateCache;
4947 if (!lambdaDelegateCache.TryGetValue(delegateType, out
MethodInfo value))
4949 value = delegateType.
GetMethod(
"Invoke");
4950 if (delegateType.CanCache())
4952 lambdaDelegateCache[delegateType] = value;
4955 ParameterInfo[] parametersCached = value.GetParametersCached();
4956 if (parametersCached.Length != 0)
4958 if (parametersCached.Length != parameters.
Count)
4960 throw Error.IncorrectNumberOfLambdaDeclarationParameters();
4962 Set<ParameterExpression>
set =
new Set<ParameterExpression>(parametersCached.Length);
4964 for (
int num = parametersCached.Length; i < num; i++)
4966 ParameterExpression parameterExpression = parameters[i];
4968 RequiresCanRead(parameterExpression,
"parameters");
4970 if (parameterExpression.IsByRef)
4974 throw Error.ParameterExpressionNotValidAsDelegate(parameterExpression.Type.MakeByRefType(), type);
4976 type = type.GetElementType();
4978 if (!TypeUtils.AreReferenceAssignable(parameterExpression.Type, type))
4980 throw Error.ParameterExpressionNotValidAsDelegate(parameterExpression.Type, type);
4982 if (
set.Contains(parameterExpression))
4984 throw Error.DuplicateVariable(parameterExpression);
4986 set.Add(parameterExpression);
4989 else if (parameters.
Count > 0)
4991 throw Error.IncorrectNumberOfLambdaDeclarationParameters();
4993 if (value.ReturnType != typeof(
void) && !TypeUtils.AreReferenceAssignable(value.ReturnType, body.Type) && !TryQuote(value.ReturnType, ref body))
4995 throw Error.ExpressionTypeDoesNotMatchReturn(body.Type, value.ReturnType);
4999 private static bool ValidateTryGetFuncActionArgs(Type[] typeArgs)
5001 if (typeArgs ==
null)
5003 throw new ArgumentNullException(
"typeArgs");
5006 for (
int num = typeArgs.Length; i < num; i++)
5008 Type type = typeArgs[i];
5011 throw new ArgumentNullException(
"typeArgs");
5028 [global::__DynamicallyInvokable]
5031 if (!ValidateTryGetFuncActionArgs(typeArgs))
5033 throw Error.TypeMustNotBeByRef();
5035 Type funcType = DelegateHelpers.GetFuncType(typeArgs);
5036 if (funcType ==
null)
5038 throw Error.IncorrectNumberOfTypeArgsForFunc();
5047 [global::__DynamicallyInvokable]
5050 if (ValidateTryGetFuncActionArgs(typeArgs))
5052 return (funcType = DelegateHelpers.GetFuncType(typeArgs)) !=
null;
5065 [global::__DynamicallyInvokable]
5068 if (!ValidateTryGetFuncActionArgs(typeArgs))
5070 throw Error.TypeMustNotBeByRef();
5072 Type actionType = DelegateHelpers.GetActionType(typeArgs);
5073 if (actionType ==
null)
5075 throw Error.IncorrectNumberOfTypeArgsForAction();
5084 [global::__DynamicallyInvokable]
5087 if (ValidateTryGetFuncActionArgs(typeArgs))
5089 return (actionType = DelegateHelpers.GetActionType(typeArgs)) !=
null;
5098 [global::__DynamicallyInvokable]
5101 ContractUtils.RequiresNotEmpty(typeArgs,
"typeArgs");
5102 ContractUtils.RequiresNotNullItems(typeArgs,
"typeArgs");
5103 return DelegateHelpers.MakeDelegateType(typeArgs);
5115 [global::__DynamicallyInvokable]
5118 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5119 ContractUtils.RequiresNotNull(initializers,
"initializers");
5132 [global::__DynamicallyInvokable]
5135 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5136 ContractUtils.RequiresNotNull(initializers,
"initializers");
5138 if (readOnlyCollection.
Count == 0)
5140 throw Error.ListInitializerWithZeroMembers();
5144 readOnlyCollection[0]
5146 return ListInit(newExpression, addMethod, initializers);
5162 [global::__DynamicallyInvokable]
5165 if (addMethod ==
null)
5169 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5170 ContractUtils.RequiresNotNull(initializers,
"initializers");
5187 [global::__DynamicallyInvokable]
5190 if (addMethod ==
null)
5192 return ListInit(newExpression, initializers);
5194 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5195 ContractUtils.RequiresNotNull(initializers,
"initializers");
5197 if (readOnlyCollection.
Count == 0)
5199 throw Error.ListInitializerWithZeroMembers();
5202 for (
int i = 0; i < readOnlyCollection.
Count; i++)
5204 array[i] =
ElementInit(addMethod, readOnlyCollection[i]);
5206 return ListInit(newExpression,
new TrueReadOnlyCollection<ElementInit>(array));
5217 [global::__DynamicallyInvokable]
5231 [global::__DynamicallyInvokable]
5234 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5235 ContractUtils.RequiresNotNull(initializers,
"initializers");
5237 if (readOnlyCollection.
Count == 0)
5239 throw Error.ListInitializerWithZeroMembers();
5241 ValidateListInitArgs(newExpression.
Type, readOnlyCollection);
5248 [global::__DynamicallyInvokable]
5251 return Loop(body,
null);
5258 [global::__DynamicallyInvokable]
5261 return Loop(body, @
break,
null);
5269 [global::__DynamicallyInvokable]
5272 RequiresCanRead(body,
"body");
5273 if (@
continue !=
null && @
continue.
Type != typeof(
void))
5275 throw Error.LabelTypeMustBeVoid();
5289 [global::__DynamicallyInvokable]
5292 ContractUtils.RequiresNotNull(member,
"member");
5293 RequiresCanRead(expression,
"expression");
5294 ValidateSettableFieldOrPropertyMember(member, out
Type memberType);
5295 if (!memberType.IsAssignableFrom(expression.Type))
5297 throw Error.ArgumentTypesMustMatch();
5311 [global::__DynamicallyInvokable]
5314 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5315 ContractUtils.RequiresNotNull(expression,
"expression");
5316 ValidateMethodInfo(propertyAccessor);
5317 return Bind(GetProperty(propertyAccessor), expression);
5320 private static void ValidateSettableFieldOrPropertyMember(
MemberInfo member, out
Type memberType)
5323 if (fieldInfo ==
null)
5326 if (propertyInfo ==
null)
5328 throw Error.ArgumentMustBeFieldInfoOrPropertInfo();
5332 throw Error.PropertyDoesNotHaveSetter(propertyInfo);
5350 [global::__DynamicallyInvokable]
5353 ContractUtils.RequiresNotNull(field,
"field");
5356 if (expression !=
null)
5358 throw new ArgumentException(Strings.OnlyStaticFieldsHaveNullInstance,
"expression");
5363 if (expression ==
null)
5367 RequiresCanRead(expression,
"expression");
5368 if (!TypeUtils.AreReferenceAssignable(field.
DeclaringType, expression.Type))
5370 throw Error.FieldInfoNotDefinedForType(field.
DeclaringType, field.
Name, expression.Type);
5383 [global::__DynamicallyInvokable]
5386 RequiresCanRead(expression,
"expression");
5394 throw Error.InstanceFieldNotDefinedForType(fieldName, expression.Type);
5396 return Field(expression, field);
5404 [global::__DynamicallyInvokable]
5407 ContractUtils.RequiresNotNull(type,
"type");
5415 throw Error.FieldNotDefinedForType(fieldName, type);
5417 return Field(expression, field);
5427 [global::__DynamicallyInvokable]
5430 RequiresCanRead(expression,
"expression");
5431 ContractUtils.RequiresNotNull(propertyName,
"propertyName");
5433 if (property ==
null)
5437 if (property ==
null)
5439 throw Error.InstancePropertyNotDefinedForType(propertyName, expression.Type);
5441 return Property(expression, property);
5449 [global::__DynamicallyInvokable]
5452 ContractUtils.RequiresNotNull(type,
"type");
5453 ContractUtils.RequiresNotNull(propertyName,
"propertyName");
5455 if (property ==
null)
5459 if (property ==
null)
5461 throw Error.PropertyNotDefinedForType(propertyName, type);
5463 return Property(expression, property);
5474 [global::__DynamicallyInvokable]
5477 ContractUtils.RequiresNotNull(property,
"property");
5478 MethodInfo methodInfo =
property.GetGetMethod(nonPublic:
true) ??
property.GetSetMethod(nonPublic:
true);
5479 if (methodInfo ==
null)
5481 throw Error.PropertyDoesNotHaveAccessor(property);
5485 if (expression !=
null)
5487 throw new ArgumentException(Strings.OnlyStaticPropertiesHaveNullInstance,
"expression");
5492 if (expression ==
null)
5494 throw new ArgumentException(Strings.OnlyStaticPropertiesHaveNullInstance,
"property");
5496 RequiresCanRead(expression,
"expression");
5497 if (!TypeUtils.IsValidInstanceType(property, expression.Type))
5499 throw Error.PropertyNotDefinedForType(property, expression.Type);
5513 [global::__DynamicallyInvokable]
5516 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5517 ValidateMethodInfo(propertyAccessor);
5518 return Property(expression, GetProperty(propertyAccessor));
5532 return propertyInfo;
5536 return propertyInfo;
5544 if (method == propertyMethod)
5549 if (declaringType.IsInterface && method.
Name == propertyMethod.
Name && declaringType.GetMethod(method.
Name) == propertyMethod)
5563 [global::__DynamicallyInvokable]
5566 RequiresCanRead(expression,
"expression");
5568 if (property !=
null)
5570 return Property(expression, property);
5575 return Field(expression, field);
5578 if (property !=
null)
5580 return Property(expression, property);
5585 return Field(expression, field);
5587 throw Error.NotAMemberOfType(propertyOrFieldName, expression.Type);
5598 [global::__DynamicallyInvokable]
5601 ContractUtils.RequiresNotNull(member,
"member");
5603 if (fieldInfo !=
null)
5605 return Field(expression, fieldInfo);
5608 if (propertyInfo !=
null)
5610 return Property(expression, propertyInfo);
5612 throw Error.MemberNotFieldOrProperty(member);
5622 [global::__DynamicallyInvokable]
5635 [global::__DynamicallyInvokable]
5638 ContractUtils.RequiresNotNull(newExpression,
"newExpression");
5639 ContractUtils.RequiresNotNull(bindings,
"bindings");
5641 ValidateMemberInitArgs(newExpression.
Type, bindings2);
5653 [global::__DynamicallyInvokable]
5656 ContractUtils.RequiresNotNull(member,
"member");
5657 ContractUtils.RequiresNotNull(initializers,
"initializers");
5669 [global::__DynamicallyInvokable]
5672 ContractUtils.RequiresNotNull(member,
"member");
5673 ContractUtils.RequiresNotNull(initializers,
"initializers");
5674 ValidateGettableFieldOrPropertyMember(member, out
Type memberType);
5676 ValidateListInitArgs(memberType, initializers2);
5688 [global::__DynamicallyInvokable]
5691 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5692 ContractUtils.RequiresNotNull(initializers,
"initializers");
5704 [global::__DynamicallyInvokable]
5707 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5708 ContractUtils.RequiresNotNull(initializers,
"initializers");
5709 return ListBind(GetProperty(propertyAccessor), initializers);
5714 if (!typeof(
IEnumerable).IsAssignableFrom(listType))
5716 throw Error.TypeNotIEnumerable(listType);
5719 for (
int count = initializers.
Count; i < count; i++)
5721 ElementInit elementInit = initializers[i];
5722 ContractUtils.RequiresNotNull(elementInit,
"initializers");
5723 ValidateCallInstanceType(listType, elementInit.AddMethod);
5735 [global::__DynamicallyInvokable]
5738 ContractUtils.RequiresNotNull(member,
"member");
5739 ContractUtils.RequiresNotNull(bindings,
"bindings");
5751 [global::__DynamicallyInvokable]
5754 ContractUtils.RequiresNotNull(member,
"member");
5755 ContractUtils.RequiresNotNull(bindings,
"bindings");
5757 ValidateGettableFieldOrPropertyMember(member, out
Type memberType);
5758 ValidateMemberInitArgs(memberType, bindings2);
5770 [global::__DynamicallyInvokable]
5773 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5774 return MemberBind(GetProperty(propertyAccessor), bindings);
5785 [global::__DynamicallyInvokable]
5788 ContractUtils.RequiresNotNull(propertyAccessor,
"propertyAccessor");
5789 return MemberBind(GetProperty(propertyAccessor), bindings);
5792 private static void ValidateGettableFieldOrPropertyMember(
MemberInfo member, out
Type memberType)
5795 if (fieldInfo ==
null)
5798 if (propertyInfo ==
null)
5800 throw Error.ArgumentMustBeFieldInfoOrPropertInfo();
5804 throw Error.PropertyDoesNotHaveGetter(propertyInfo);
5817 int count = bindings.
Count;
5823 memberBinding = bindings[num];
5824 ContractUtils.RequiresNotNull(memberBinding,
"bindings");
5825 if (!memberBinding.Member.DeclaringType.IsAssignableFrom(type))
5834 throw Error.NotAMemberOfType(memberBinding.Member.Name, type);
5843 [global::__DynamicallyInvokable]
5846 ContractUtils.RequiresNotNull(method,
"method");
5847 ContractUtils.RequiresNotNull(arg0,
"arg0");
5848 ParameterInfo[] array = ValidateMethodAndGetParameters(
null, method);
5850 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
5851 return new MethodCallExpression1(method, arg0);
5861 [global::__DynamicallyInvokable]
5864 ContractUtils.RequiresNotNull(method,
"method");
5865 ContractUtils.RequiresNotNull(arg0,
"arg0");
5866 ContractUtils.RequiresNotNull(arg1,
"arg1");
5867 ParameterInfo[] array = ValidateMethodAndGetParameters(
null, method);
5869 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
5870 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
5871 return new MethodCallExpression2(method, arg0, arg1);
5882 [global::__DynamicallyInvokable]
5885 ContractUtils.RequiresNotNull(method,
"method");
5886 ContractUtils.RequiresNotNull(arg0,
"arg0");
5887 ContractUtils.RequiresNotNull(arg1,
"arg1");
5888 ContractUtils.RequiresNotNull(arg2,
"arg2");
5889 ParameterInfo[] array = ValidateMethodAndGetParameters(
null, method);
5891 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
5892 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
5893 arg2 = ValidateOneArgument(method,
ExpressionType.Call, arg2, array[2]);
5894 return new MethodCallExpression3(method, arg0, arg1, arg2);
5906 [global::__DynamicallyInvokable]
5909 ContractUtils.RequiresNotNull(method,
"method");
5910 ContractUtils.RequiresNotNull(arg0,
"arg0");
5911 ContractUtils.RequiresNotNull(arg1,
"arg1");
5912 ContractUtils.RequiresNotNull(arg2,
"arg2");
5913 ContractUtils.RequiresNotNull(arg3,
"arg3");
5914 ParameterInfo[] array = ValidateMethodAndGetParameters(
null, method);
5916 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
5917 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
5918 arg2 = ValidateOneArgument(method,
ExpressionType.Call, arg2, array[2]);
5919 arg3 = ValidateOneArgument(method,
ExpressionType.Call, arg3, array[3]);
5920 return new MethodCallExpression4(method, arg0, arg1, arg2, arg3);
5933 [global::__DynamicallyInvokable]
5936 ContractUtils.RequiresNotNull(method,
"method");
5937 ContractUtils.RequiresNotNull(arg0,
"arg0");
5938 ContractUtils.RequiresNotNull(arg1,
"arg1");
5939 ContractUtils.RequiresNotNull(arg2,
"arg2");
5940 ContractUtils.RequiresNotNull(arg3,
"arg3");
5941 ContractUtils.RequiresNotNull(arg4,
"arg4");
5942 ParameterInfo[] array = ValidateMethodAndGetParameters(
null, method);
5944 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
5945 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
5946 arg2 = ValidateOneArgument(method,
ExpressionType.Call, arg2, array[2]);
5947 arg3 = ValidateOneArgument(method,
ExpressionType.Call, arg3, array[3]);
5948 arg4 = ValidateOneArgument(method,
ExpressionType.Call, arg4, array[4]);
5949 return new MethodCallExpression5(method, arg0, arg1, arg2, arg3, arg4);
5959 [global::__DynamicallyInvokable]
5962 return Call(
null, method, arguments);
5969 [global::__DynamicallyInvokable]
5972 return Call(
null, method, arguments);
5984 [global::__DynamicallyInvokable]
5987 return Call(instance, method, EmptyReadOnlyCollection<Expression>.
Instance);
6001 [global::__DynamicallyInvokable]
6013 [global::__DynamicallyInvokable]
6016 ContractUtils.RequiresNotNull(method,
"method");
6017 ContractUtils.RequiresNotNull(arg0,
"arg0");
6018 ContractUtils.RequiresNotNull(arg1,
"arg1");
6019 ParameterInfo[] array = ValidateMethodAndGetParameters(instance, method);
6021 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
6022 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
6023 if (instance !=
null)
6025 return new InstanceMethodCallExpression2(method, instance, arg0, arg1);
6027 return new MethodCallExpression2(method, arg0, arg1);
6037 [global::__DynamicallyInvokable]
6040 ContractUtils.RequiresNotNull(method,
"method");
6041 ContractUtils.RequiresNotNull(arg0,
"arg0");
6042 ContractUtils.RequiresNotNull(arg1,
"arg1");
6043 ContractUtils.RequiresNotNull(arg2,
"arg2");
6044 ParameterInfo[] array = ValidateMethodAndGetParameters(instance, method);
6046 arg0 = ValidateOneArgument(method,
ExpressionType.Call, arg0, array[0]);
6047 arg1 = ValidateOneArgument(method,
ExpressionType.Call, arg1, array[1]);
6048 arg2 = ValidateOneArgument(method,
ExpressionType.Call, arg2, array[2]);
6049 if (instance !=
null)
6051 return new InstanceMethodCallExpression3(method, instance, arg0, arg1, arg2);
6053 return new MethodCallExpression3(method, arg0, arg1, arg2);
6065 [global::__DynamicallyInvokable]
6068 ContractUtils.RequiresNotNull(instance,
"instance");
6069 ContractUtils.RequiresNotNull(methodName,
"methodName");
6070 if (arguments ==
null)
6075 return Call(instance, FindMethod(instance.Type, methodName, typeArguments, arguments, flags), arguments);
6087 [global::__DynamicallyInvokable]
6090 ContractUtils.RequiresNotNull(type,
"type");
6091 ContractUtils.RequiresNotNull(methodName,
"methodName");
6092 if (arguments ==
null)
6097 return Call(
null, FindMethod(type, methodName, typeArguments, arguments, flags), arguments);
6110 [global::__DynamicallyInvokable]
6113 ContractUtils.RequiresNotNull(method,
"method");
6115 ValidateMethodInfo(method);
6116 ValidateStaticOrInstanceMethod(instance, method);
6117 ValidateArgumentTypes(method,
ExpressionType.Call, ref arguments2);
6118 if (instance ==
null)
6120 return new MethodCallExpressionN(method, arguments2);
6122 return new InstanceMethodCallExpressionN(method, instance, arguments2);
6127 ValidateMethodInfo(method);
6128 ValidateStaticOrInstanceMethod(instance, method);
6132 private static void ValidateStaticOrInstanceMethod(Expression instance,
MethodInfo method)
6136 if (instance !=
null)
6138 throw new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance,
"instance");
6142 if (instance ==
null)
6144 throw new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance,
"method");
6146 RequiresCanRead(instance,
"instance");
6147 ValidateCallInstanceType(instance.Type, method);
6150 private static void ValidateCallInstanceType(Type instanceType,
MethodInfo method)
6152 if (!TypeUtils.IsValidInstanceType(method, instanceType))
6154 throw Error.InstanceAndMethodTypeMismatch(method, method.
DeclaringType, instanceType);
6160 ParameterInfo[] parametersForValidation = GetParametersForValidation(method, nodeKind);
6161 ValidateArgumentCount(method, nodeKind, arguments.Count, parametersForValidation);
6162 Expression[] array =
null;
6164 for (
int num = parametersForValidation.Length; i < num; i++)
6166 Expression arg = arguments[i];
6168 arg = ValidateOneArgument(method, nodeKind, arg, pi);
6169 if (array ==
null && arg != arguments[i])
6171 array =
new Expression[arguments.Count];
6172 for (
int j = 0; j < i; j++)
6174 array[j] = arguments[j];
6184 arguments =
new TrueReadOnlyCollection<Expression>(array);
6193 array = array.RemoveFirst();
6200 if (pis.Length != count)
6205 throw Error.IncorrectNumberOfConstructorArguments();
6207 throw Error.IncorrectNumberOfLambdaArguments();
6210 throw Error.IncorrectNumberOfMethodCallArguments(method);
6212 throw ContractUtils.Unreachable;
6219 RequiresCanRead(arg,
"arguments");
6225 TypeUtils.ValidateType(type);
6226 if (!TypeUtils.AreReferenceAssignable(type, arg.Type) && !TryQuote(type, ref arg))
6231 throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, type);
6233 throw Error.ExpressionTypeDoesNotMatchParameter(arg.Type, type);
6236 throw Error.ExpressionTypeDoesNotMatchMethodParameter(arg.Type, type, method);
6238 throw ContractUtils.Unreachable;
6244 private static bool TryQuote(Type parameterType, ref Expression argument)
6246 Type typeFromHandle = typeof(LambdaExpression);
6247 if (TypeUtils.IsSameOrSubclass(typeFromHandle, parameterType) && parameterType.IsAssignableFrom(argument.GetType()))
6249 argument =
Quote(argument);
6255 private static MethodInfo FindMethod(Type type,
string methodName, Type[] typeArgs, Expression[] args,
BindingFlags flags)
6258 if (array ==
null || array.Length == 0)
6260 throw Error.MethodDoesNotExistOnType(methodName, type);
6264 int num = FindBestMethod(methods, typeArgs, args, out method);
6267 if (typeArgs !=
null && typeArgs.Length != 0)
6269 throw Error.GenericMethodWithArgsDoesNotExistOnType(methodName, type);
6271 throw Error.MethodWithArgsDoesNotExistOnType(methodName, type);
6275 throw Error.MethodWithMoreThanOneMatch(methodName, type);
6286 MethodInfo methodInfo = ApplyTypeArgs(method2, typeArgs);
6287 if (methodInfo !=
null && IsCompatible(methodInfo, args))
6289 if (method ==
null || (!method.IsPublic && methodInfo.
IsPublic))
6291 method = methodInfo;
6294 else if (method.IsPublic == methodInfo.
IsPublic)
6303 private static bool IsCompatible(
MethodBase m, Expression[] args)
6306 if (parametersCached.Length != args.Length)
6310 for (
int i = 0; i < args.Length; i++)
6312 Expression expression = args[i];
6313 ContractUtils.RequiresNotNull(expression,
"argument");
6314 Type type = expression.Type;
6320 if (!TypeUtils.AreReferenceAssignable(type2, type) && (!TypeUtils.IsSameOrSubclass(typeof(LambdaExpression), type2) || !type2.IsAssignableFrom(expression.GetType())))
6330 if (typeArgs ==
null || typeArgs.Length == 0)
6352 [global::__DynamicallyInvokable]
6366 [global::__DynamicallyInvokable]
6369 RequiresCanRead(array,
"array");
6370 ContractUtils.RequiresNotNull(indexes,
"indexes");
6371 Type type = array.Type;
6374 throw Error.ArgumentMustBeArray();
6379 throw Error.IncorrectNumberOfIndexes();
6381 foreach (
Expression item
in readOnlyCollection)
6383 RequiresCanRead(item,
"indexes");
6384 if (item.Type != typeof(
int))
6386 throw Error.ArgumentMustBeArrayIndexType();
6390 return Call(array, method, readOnlyCollection);
6400 [global::__DynamicallyInvokable]
6413 [global::__DynamicallyInvokable]
6416 ContractUtils.RequiresNotNull(type,
"type");
6417 ContractUtils.RequiresNotNull(initializers,
"initializers");
6418 if (type.
Equals(typeof(
void)))
6420 throw Error.ArgumentCannotBeOfTypeVoid();
6425 for (
int count = readOnlyCollection.
Count; i < count; i++)
6428 RequiresCanRead(argument,
"initializers");
6429 if (!TypeUtils.AreReferenceAssignable(type, argument.Type))
6431 if (!TryQuote(type, ref argument))
6433 throw Error.ExpressionTypeCannotInitializeArrayType(argument.Type, type);
6438 for (
int j = 0; j < i; j++)
6440 array[j] = readOnlyCollection[j];
6446 array[i] = argument;
6451 readOnlyCollection =
new TrueReadOnlyCollection<Expression>(array);
6463 [global::__DynamicallyInvokable]
6476 [global::__DynamicallyInvokable]
6479 ContractUtils.RequiresNotNull(type,
"type");
6480 ContractUtils.RequiresNotNull(bounds,
"bounds");
6481 if (type.
Equals(typeof(
void)))
6483 throw Error.ArgumentCannotBeOfTypeVoid();
6486 int count = readOnlyCollection.
Count;
6489 throw Error.BoundsCannotBeLessThanOne();
6491 for (
int i = 0; i < count; i++)
6493 Expression expression = readOnlyCollection[i];
6494 RequiresCanRead(expression,
"bounds");
6495 if (!TypeUtils.IsInteger(expression.Type))
6497 throw Error.ArgumentMustBeInteger();
6510 [global::__DynamicallyInvokable]
6523 [global::__DynamicallyInvokable]
6536 [global::__DynamicallyInvokable]
6539 ContractUtils.RequiresNotNull(constructor,
"constructor");
6540 ContractUtils.RequiresNotNull(constructor.
DeclaringType,
"constructor.DeclaringType");
6543 ValidateArgumentTypes(constructor,
ExpressionType.New, ref arguments2);
6555 [global::__DynamicallyInvokable]
6558 ContractUtils.RequiresNotNull(constructor,
"constructor");
6561 ValidateNewArgs(constructor, ref arguments2, ref members2);
6562 return new NewExpression(constructor, arguments2, members2);
6573 [global::__DynamicallyInvokable]
6585 [global::__DynamicallyInvokable]
6588 ContractUtils.RequiresNotNull(type,
"type");
6589 if (type == typeof(
void))
6591 throw Error.ArgumentCannotBeOfTypeVoid();
6597 if (constructorInfo ==
null)
6599 throw Error.TypeMissingDefaultConstructor(type);
6601 return New(constructorInfo);
6603 return new NewValueTypeExpression(type, EmptyReadOnlyCollection<Expression>.
Instance,
null);
6609 if ((parametersCached = constructor.GetParametersCached()).Length != 0)
6611 if (arguments.Count != parametersCached.Length)
6613 throw Error.IncorrectNumberOfConstructorArguments();
6615 if (arguments.Count != members.Count)
6617 throw Error.IncorrectNumberOfArgumentsForMembers();
6619 Expression[] array =
null;
6622 for (
int count = arguments.Count; i < count; i++)
6624 Expression argument = arguments[i];
6625 RequiresCanRead(argument,
"argument");
6627 ContractUtils.RequiresNotNull(member,
"member");
6632 ValidateAnonymousTypeMember(ref member, out Type memberType);
6633 if (!TypeUtils.AreReferenceAssignable(memberType, argument.Type) && !TryQuote(memberType, ref argument))
6635 throw Error.ArgumentTypeDoesNotMatchMember(argument.Type, memberType);
6643 if (!TypeUtils.AreReferenceAssignable(type, argument.Type) && !TryQuote(type, ref argument))
6645 throw Error.ExpressionTypeDoesNotMatchConstructorParameter(argument.Type, type);
6647 if (array ==
null && argument != arguments[i])
6649 array =
new Expression[arguments.Count];
6650 for (
int j = 0; j < i; j++)
6652 array[j] = arguments[j];
6657 array[i] = argument;
6659 if (array2 ==
null && member != members[i])
6662 for (
int k = 0; k < i; k++)
6664 array2[k] = members[k];
6674 arguments =
new TrueReadOnlyCollection<Expression>(array);
6678 members =
new TrueReadOnlyCollection<MemberInfo>(array2);
6683 if (arguments !=
null && arguments.Count > 0)
6685 throw Error.IncorrectNumberOfConstructorArguments();
6687 if (members !=
null && members.Count > 0)
6689 throw Error.IncorrectNumberOfMembersForGivenConstructor();
6694 private static void ValidateAnonymousTypeMember(ref
MemberInfo member, out Type memberType)
6696 switch (member.MemberType)
6703 throw Error.ArgumentMustBeInstanceMember();
6713 throw Error.PropertyDoesNotHaveGetter(propertyInfo);
6717 throw Error.ArgumentMustBeInstanceMember();
6727 throw Error.ArgumentMustBeInstanceMember();
6729 memberType = ((
PropertyInfo)(member = GetProperty(methodInfo))).PropertyType;
6733 throw Error.ArgumentMustBeFieldInfoOrPropertInfoOrMethod();
6740 [global::__DynamicallyInvokable]
6749 [global::__DynamicallyInvokable]
6761 [global::__DynamicallyInvokable]
6764 ContractUtils.RequiresNotNull(type,
"type");
6765 if (type == typeof(
void))
6767 throw Error.ArgumentCannotBeOfTypeVoid();
6781 [global::__DynamicallyInvokable]
6784 ContractUtils.RequiresNotNull(type,
"type");
6785 if (type == typeof(
void))
6787 throw Error.ArgumentCannotBeOfTypeVoid();
6791 throw Error.TypeMustNotBeByRef();
6799 [global::__DynamicallyInvokable]
6808 [global::__DynamicallyInvokable]
6811 ContractUtils.RequiresNotNull(variables,
"variables");
6813 for (
int i = 0; i < readOnlyCollection.
Count; i++)
6815 Expression expression = readOnlyCollection[i];
6816 if (expression ==
null)
6828 [global::__DynamicallyInvokable]
6838 [global::__DynamicallyInvokable]
6841 RequiresCanRead(body,
"body");
6843 RequiresCanRead(readOnlyCollection,
"testValues");
6844 ContractUtils.RequiresNotEmpty(readOnlyCollection,
"testValues");
6845 return new SwitchCase(body, readOnlyCollection);
6852 [global::__DynamicallyInvokable]
6863 [global::__DynamicallyInvokable]
6875 [global::__DynamicallyInvokable]
6888 [global::__DynamicallyInvokable]
6900 [global::__DynamicallyInvokable]
6903 return Switch(
null, switchValue, defaultBody, comparison, cases);
6913 [global::__DynamicallyInvokable]
6916 RequiresCanRead(switchValue,
"switchValue");
6917 if (switchValue.Type == typeof(
void))
6919 throw Error.ArgumentCannotBeOfTypeVoid();
6922 ContractUtils.RequiresNotEmpty(readOnlyCollection,
"cases");
6923 ContractUtils.RequiresNotNullItems(readOnlyCollection,
"cases");
6924 Type type2 = type ?? readOnlyCollection[0].Body.Type;
6925 bool customType = type !=
null;
6926 if (comparison !=
null)
6928 ParameterInfo[] parametersCached = comparison.GetParametersCached();
6929 if (parametersCached.Length != 2)
6931 throw Error.IncorrectNumberOfMethodCallArguments(comparison);
6935 if (!ParameterIsAssignable(parameterInfo, switchValue.Type))
6937 flag = ParameterIsAssignable(parameterInfo, switchValue.Type.GetNonNullableType());
6940 throw Error.SwitchValueTypeDoesNotMatchComparisonMethodParameter(switchValue.Type, parameterInfo.
ParameterType);
6944 foreach (
SwitchCase item
in readOnlyCollection)
6946 ContractUtils.RequiresNotNull(item,
"cases");
6947 ValidateSwitchCaseType(item.Body, customType, type2,
"cases");
6948 for (
int i = 0; i < item.TestValues.Count; i++)
6950 Type type3 = item.TestValues[i].Type;
6953 if (!type3.IsNullableType())
6955 throw Error.TestValueTypeDoesNotMatchComparisonMethodParameter(type3, parameterInfo2.ParameterType);
6957 type3 = type3.GetNonNullableType();
6959 if (!ParameterIsAssignable(parameterInfo2, type3))
6961 throw Error.TestValueTypeDoesNotMatchComparisonMethodParameter(type3, parameterInfo2.ParameterType);
6968 Expression expression = readOnlyCollection[0].TestValues[0];
6969 foreach (
SwitchCase item2
in readOnlyCollection)
6971 ContractUtils.RequiresNotNull(item2,
"cases");
6972 ValidateSwitchCaseType(item2.
Body, customType, type2,
"cases");
6973 for (
int j = 0; j < item2.
TestValues.Count; j++)
6975 if (!TypeUtils.AreEquivalent(expression.Type, item2.
TestValues[j].Type))
6982 comparison = binaryExpression.
Method;
6984 if (defaultBody ==
null)
6986 if (type2 != typeof(
void))
6988 throw Error.DefaultBodyMustBeSupplied();
6993 ValidateSwitchCaseType(defaultBody, customType, type2,
"defaultBody");
6995 if (comparison !=
null && comparison.
ReturnType != typeof(
bool))
6997 throw Error.EqualityMustReturnBoolean(comparison);
6999 return new SwitchExpression(type2, switchValue, defaultBody, comparison, readOnlyCollection);
7002 private static void ValidateSwitchCaseType(
Expression @
case,
bool customType,
Type resultType,
string parameterName)
7006 if (resultType != typeof(
void) && !TypeUtils.AreReferenceAssignable(resultType, @
case.Type))
7011 else if (!TypeUtils.AreEquivalent(resultType, @
case.Type))
7013 throw new ArgumentException(Strings.AllCaseBodiesMustHaveSameType, parameterName);
7020 [global::__DynamicallyInvokable]
7030 [global::__DynamicallyInvokable]
7033 return new SymbolDocumentWithGuids(fileName, ref language);
7041 [global::__DynamicallyInvokable]
7044 return new SymbolDocumentWithGuids(fileName, ref language, ref languageVendor);
7053 [global::__DynamicallyInvokable]
7056 return new SymbolDocumentWithGuids(fileName, ref language, ref languageVendor, ref documentType);
7063 [global::__DynamicallyInvokable]
7066 return MakeTry(
null, body,
null, fault,
null);
7073 [global::__DynamicallyInvokable]
7076 return MakeTry(
null, body,
@finally,
null,
null);
7083 [global::__DynamicallyInvokable]
7086 return MakeTry(
null, body,
null,
null, handlers);
7094 [global::__DynamicallyInvokable]
7097 return MakeTry(
null, body,
@finally,
null, handlers);
7107 [global::__DynamicallyInvokable]
7110 RequiresCanRead(body,
"body");
7112 ContractUtils.RequiresNotNullItems(readOnlyCollection,
"handlers");
7113 ValidateTryAndCatchHaveSameType(type, body, readOnlyCollection);
7116 if (
@finally !=
null || readOnlyCollection.
Count > 0)
7118 throw Error.FaultCannotHaveCatchOrFinally();
7120 RequiresCanRead(fault,
"fault");
7122 else if (
@finally !=
null)
7124 RequiresCanRead(
@finally,
"finally");
7126 else if (readOnlyCollection.
Count == 0)
7128 throw Error.TryMustHaveCatchFinallyOrFault();
7130 return new TryExpression(type ?? body.Type, body,
@finally, fault, readOnlyCollection);
7137 if (type != typeof(
void))
7139 if (!TypeUtils.AreReferenceAssignable(type, tryBody.Type))
7141 throw Error.ArgumentTypesMustMatch();
7143 foreach (CatchBlock handler
in handlers)
7145 if (!TypeUtils.AreReferenceAssignable(type, handler.Body.Type))
7147 throw Error.ArgumentTypesMustMatch();
7152 else if (tryBody ==
null || tryBody.Type == typeof(
void))
7154 foreach (CatchBlock handler2
in handlers)
7156 if (handler2.Body !=
null && handler2.Body.Type != typeof(
void))
7158 throw Error.BodyOfCatchMustHaveSameTypeAsBodyOfTry();
7164 type = tryBody.Type;
7165 foreach (CatchBlock handler3
in handlers)
7167 if (handler3.Body ==
null || !TypeUtils.AreEquivalent(handler3.Body.Type, type))
7169 throw Error.BodyOfCatchMustHaveSameTypeAsBodyOfTry();
7181 [global::__DynamicallyInvokable]
7184 RequiresCanRead(expression,
"expression");
7185 ContractUtils.RequiresNotNull(type,
"type");
7188 throw Error.TypeMustNotBeByRef();
7197 [global::__DynamicallyInvokable]
7200 RequiresCanRead(expression,
"expression");
7201 ContractUtils.RequiresNotNull(type,
"type");
7204 throw Error.TypeMustNotBeByRef();
7218 [global::__DynamicallyInvokable]
7221 return MakeUnary(unaryType, operand, type,
null);
7234 [global::__DynamicallyInvokable]
7240 return Negate(operand, method);
7244 return Not(operand, method);
7246 return IsFalse(operand, method);
7248 return IsTrue(operand, method);
7254 return Convert(operand, type, method);
7258 return Throw(operand, type);
7260 return TypeAs(operand, type);
7262 return Quote(operand);
7266 return Unbox(operand, type);
7280 throw Error.UnhandledUnary(unaryType);
7286 UnaryExpression userDefinedUnaryOperator = GetUserDefinedUnaryOperator(unaryType, name, operand);
7287 if (userDefinedUnaryOperator !=
null)
7289 ValidateParamswithOperandsOrThrow(userDefinedUnaryOperator.
Method.GetParametersCached()[0].ParameterType, operand.Type, unaryType, name);
7290 return userDefinedUnaryOperator;
7292 throw Error.UnaryOperatorNotDefined(unaryType, operand.Type);
7295 private static UnaryExpression GetUserDefinedUnaryOperator(
ExpressionType unaryType,
string name, Expression operand)
7297 Type type = operand.Type;
7302 Type nonNullableType = type.GetNonNullableType();
7304 MethodInfo methodValidated = nonNullableType.GetMethodValidated(name, bindingAttr,
null, array,
null);
7305 if (methodValidated !=
null)
7307 return new UnaryExpression(unaryType, operand, methodValidated.
ReturnType, methodValidated);
7309 if (type.IsNullableType())
7311 array[0] = nonNullableType;
7312 methodValidated = nonNullableType.GetMethodValidated(name, bindingAttr,
null, array,
null);
7315 return new UnaryExpression(unaryType, operand, TypeUtils.GetNullableType(methodValidated.
ReturnType), methodValidated);
7321 private static UnaryExpression GetMethodBasedUnaryOperator(
ExpressionType unaryType, Expression operand,
MethodInfo method)
7323 ValidateOperator(method);
7324 ParameterInfo[] parametersCached = method.GetParametersCached();
7325 if (parametersCached.Length != 1)
7327 throw Error.IncorrectNumberOfMethodCallArguments(method);
7329 if (ParameterIsAssignable(parametersCached[0], operand.Type))
7331 ValidateParamswithOperandsOrThrow(parametersCached[0].ParameterType, operand.Type, unaryType, method.
Name);
7332 return new UnaryExpression(unaryType, operand, method.
ReturnType, method);
7334 if (operand.Type.IsNullableType() && ParameterIsAssignable(parametersCached[0], operand.Type.GetNonNullableType()) && method.
ReturnType.
IsValueType && !method.
ReturnType.IsNullableType())
7336 return new UnaryExpression(unaryType, operand, TypeUtils.GetNullableType(method.
ReturnType), method);
7338 throw Error.OperandTypesDoNotMatchParameters(unaryType, method.
Name);
7341 private static UnaryExpression GetUserDefinedCoercionOrThrow(
ExpressionType coercionType, Expression expression, Type convertToType)
7343 UnaryExpression userDefinedCoercion = GetUserDefinedCoercion(coercionType, expression, convertToType);
7344 if (userDefinedCoercion !=
null)
7346 return userDefinedCoercion;
7348 throw Error.CoercionOperatorNotDefined(expression.Type, convertToType);
7351 private static UnaryExpression GetUserDefinedCoercion(
ExpressionType coercionType, Expression expression, Type convertToType)
7353 MethodInfo userDefinedCoercionMethod = TypeUtils.GetUserDefinedCoercionMethod(expression.Type, convertToType, implicitOnly:
false);
7354 if (userDefinedCoercionMethod !=
null)
7356 return new UnaryExpression(coercionType, expression, convertToType, userDefinedCoercionMethod);
7361 private static UnaryExpression GetMethodBasedCoercionOperator(
ExpressionType unaryType, Expression operand, Type convertToType,
MethodInfo method)
7363 ValidateOperator(method);
7364 ParameterInfo[] parametersCached = method.GetParametersCached();
7365 if (parametersCached.Length != 1)
7367 throw Error.IncorrectNumberOfMethodCallArguments(method);
7369 if (ParameterIsAssignable(parametersCached[0], operand.Type) && TypeUtils.AreEquivalent(method.
ReturnType, convertToType))
7371 return new UnaryExpression(unaryType, operand, method.
ReturnType, method);
7373 if ((operand.Type.IsNullableType() || convertToType.IsNullableType()) && ParameterIsAssignable(parametersCached[0], operand.Type.GetNonNullableType()) && TypeUtils.AreEquivalent(method.
ReturnType, convertToType.GetNonNullableType()))
7375 return new UnaryExpression(unaryType, operand, convertToType, method);
7377 throw Error.OperandTypesDoNotMatchParameters(unaryType, method.
Name);
7386 [global::__DynamicallyInvokable]
7389 return Negate(expression,
null);
7403 [global::__DynamicallyInvokable]
7406 RequiresCanRead(expression,
"expression");
7409 if (TypeUtils.IsArithmetic(expression.Type) && !TypeUtils.IsUnsignedInt(expression.Type))
7413 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.Negate,
"op_UnaryNegation", expression);
7415 return GetMethodBasedUnaryOperator(
ExpressionType.Negate, expression, method);
7424 [global::__DynamicallyInvokable]
7441 [global::__DynamicallyInvokable]
7444 RequiresCanRead(expression,
"expression");
7447 if (TypeUtils.IsArithmetic(expression.Type))
7451 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.UnaryPlus,
"op_UnaryPlus", expression);
7453 return GetMethodBasedUnaryOperator(
ExpressionType.UnaryPlus, expression, method);
7462 [global::__DynamicallyInvokable]
7479 [global::__DynamicallyInvokable]
7482 RequiresCanRead(expression,
"expression");
7485 if (TypeUtils.IsArithmetic(expression.Type) && !TypeUtils.IsUnsignedInt(expression.Type))
7489 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.NegateChecked,
"op_UnaryNegation", expression);
7491 return GetMethodBasedUnaryOperator(
ExpressionType.NegateChecked, expression, method);
7500 [global::__DynamicallyInvokable]
7503 return Not(expression,
null);
7517 [global::__DynamicallyInvokable]
7520 RequiresCanRead(expression,
"expression");
7523 if (TypeUtils.IsIntegerOrBool(expression.Type))
7528 if (userDefinedUnaryOperator !=
null)
7530 return userDefinedUnaryOperator;
7532 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.Not,
"op_OnesComplement", expression);
7534 return GetMethodBasedUnaryOperator(
ExpressionType.Not, expression, method);
7540 [global::__DynamicallyInvokable]
7543 return IsFalse(expression,
null);
7550 [global::__DynamicallyInvokable]
7553 RequiresCanRead(expression,
"expression");
7556 if (TypeUtils.IsBool(expression.Type))
7560 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.IsFalse,
"op_False", expression);
7562 return GetMethodBasedUnaryOperator(
ExpressionType.IsFalse, expression, method);
7568 [global::__DynamicallyInvokable]
7571 return IsTrue(expression,
null);
7578 [global::__DynamicallyInvokable]
7581 RequiresCanRead(expression,
"expression");
7584 if (TypeUtils.IsBool(expression.Type))
7588 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.IsTrue,
"op_True", expression);
7590 return GetMethodBasedUnaryOperator(
ExpressionType.IsTrue, expression, method);
7596 [global::__DynamicallyInvokable]
7606 [global::__DynamicallyInvokable]
7609 RequiresCanRead(expression,
"expression");
7612 if (TypeUtils.IsInteger(expression.Type))
7616 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.OnesComplement,
"op_OnesComplement", expression);
7618 return GetMethodBasedUnaryOperator(
ExpressionType.OnesComplement, expression, method);
7627 [global::__DynamicallyInvokable]
7630 RequiresCanRead(expression,
"expression");
7631 ContractUtils.RequiresNotNull(type,
"type");
7632 TypeUtils.ValidateType(type);
7635 throw Error.IncorrectTypeForTypeAs(type);
7644 [global::__DynamicallyInvokable]
7647 RequiresCanRead(expression,
"expression");
7648 ContractUtils.RequiresNotNull(type,
"type");
7649 if (!expression.Type.IsInterface && expression.Type != typeof(
object))
7651 throw Error.InvalidUnboxType();
7655 throw Error.InvalidUnboxType();
7657 TypeUtils.ValidateType(type);
7668 [global::__DynamicallyInvokable]
7671 return Convert(expression, type,
null);
7687 [global::__DynamicallyInvokable]
7690 RequiresCanRead(expression,
"expression");
7691 ContractUtils.RequiresNotNull(type,
"type");
7692 TypeUtils.ValidateType(type);
7695 if (TypeUtils.HasIdentityPrimitiveOrNullableConversion(expression.Type, type) || TypeUtils.HasReferenceConversion(expression.Type, type))
7699 return GetUserDefinedCoercionOrThrow(
ExpressionType.Convert, expression, type);
7701 return GetMethodBasedCoercionOperator(
ExpressionType.Convert, expression, type, method);
7711 [global::__DynamicallyInvokable]
7730 [global::__DynamicallyInvokable]
7733 RequiresCanRead(expression,
"expression");
7734 ContractUtils.RequiresNotNull(type,
"type");
7735 TypeUtils.ValidateType(type);
7738 if (TypeUtils.HasIdentityPrimitiveOrNullableConversion(expression.Type, type))
7742 if (TypeUtils.HasReferenceConversion(expression.Type, type))
7746 return GetUserDefinedCoercionOrThrow(
ExpressionType.ConvertChecked, expression, type);
7748 return GetMethodBasedCoercionOperator(
ExpressionType.ConvertChecked, expression, type, method);
7758 [global::__DynamicallyInvokable]
7761 ContractUtils.RequiresNotNull(array,
"array");
7762 if (!array.Type.IsArray || !typeof(
Array).IsAssignableFrom(array.Type))
7764 throw Error.ArgumentMustBeArray();
7766 if (array.Type.GetArrayRank() != 1)
7768 throw Error.ArgumentMustBeSingleDimensionalArrayType();
7778 [global::__DynamicallyInvokable]
7781 RequiresCanRead(expression,
"expression");
7784 throw Error.QuotedExpressionMustBeLambda();
7791 [global::__DynamicallyInvokable]
7800 [global::__DynamicallyInvokable]
7803 return Throw(
null, type);
7809 [global::__DynamicallyInvokable]
7812 return Throw(value, typeof(
void));
7819 [global::__DynamicallyInvokable]
7822 ContractUtils.RequiresNotNull(type,
"type");
7823 TypeUtils.ValidateType(type);
7826 RequiresCanRead(value,
"value");
7827 if (value.Type.IsValueType)
7829 throw Error.ArgumentMustNotHaveValueType();
7838 [global::__DynamicallyInvokable]
7848 [global::__DynamicallyInvokable]
7851 RequiresCanRead(expression,
"expression");
7854 if (TypeUtils.IsArithmetic(expression.Type))
7858 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.Increment,
"op_Increment", expression);
7860 return GetMethodBasedUnaryOperator(
ExpressionType.Increment, expression, method);
7866 [global::__DynamicallyInvokable]
7876 [global::__DynamicallyInvokable]
7879 RequiresCanRead(expression,
"expression");
7882 if (TypeUtils.IsArithmetic(expression.Type))
7886 return GetUserDefinedUnaryOperatorOrThrow(
ExpressionType.Decrement,
"op_Decrement", expression);
7888 return GetMethodBasedUnaryOperator(
ExpressionType.Decrement, expression, method);
7894 [global::__DynamicallyInvokable]
7897 return MakeOpAssignUnary(
ExpressionType.PreIncrementAssign, expression,
null);
7904 [global::__DynamicallyInvokable]
7907 return MakeOpAssignUnary(
ExpressionType.PreIncrementAssign, expression, method);
7913 [global::__DynamicallyInvokable]
7916 return MakeOpAssignUnary(
ExpressionType.PreDecrementAssign, expression,
null);
7923 [global::__DynamicallyInvokable]
7926 return MakeOpAssignUnary(
ExpressionType.PreDecrementAssign, expression, method);
7932 [global::__DynamicallyInvokable]
7935 return MakeOpAssignUnary(
ExpressionType.PostIncrementAssign, expression,
null);
7942 [global::__DynamicallyInvokable]
7945 return MakeOpAssignUnary(
ExpressionType.PostIncrementAssign, expression, method);
7951 [global::__DynamicallyInvokable]
7954 return MakeOpAssignUnary(
ExpressionType.PostDecrementAssign, expression,
null);
7961 [global::__DynamicallyInvokable]
7964 return MakeOpAssignUnary(
ExpressionType.PostDecrementAssign, expression, method);
7969 RequiresCanRead(expression,
"expression");
7970 RequiresCanWrite(expression,
"expression");
7974 if (TypeUtils.IsArithmetic(expression.Type))
7978 string name = (kind !=
ExpressionType.PreIncrementAssign && kind !=
ExpressionType.PostIncrementAssign) ?
"op_Decrement" :
"op_Increment";
7979 unaryExpression = GetUserDefinedUnaryOperatorOrThrow(kind, name, expression);
7983 unaryExpression = GetMethodBasedUnaryOperator(kind, expression, method);
7985 if (!TypeUtils.AreReferenceAssignable(expression.Type, unaryExpression.
Type))
7987 throw Error.UserDefinedOpMustHaveValidReturnType(kind, method.
Name);
7989 return unaryExpression;
7994 [global::__DynamicallyInvokable]
7998 : base(typeof(TDelegate), name, body, tailCall, parameters)
8004 [global::__DynamicallyInvokable]
8007 return (TDelegate)(object)LambdaCompiler.Compile(
this,
null);
8015 ContractUtils.RequiresNotNull(debugInfoGenerator,
"debugInfoGenerator");
8016 return (TDelegate)(object)LambdaCompiler.Compile(
this, debugInfoGenerator);
8023 public new TDelegate
Compile(
bool preferInterpretation)
8032 [global::__DynamicallyInvokable]
8035 if (body == base.Body && parameters == base.Parameters)
8039 return Expression.Lambda<TDelegate>(body, base.Name, base.TailCall, parameters);
8044 return visitor.VisitLambda(
this);
8047 internal override LambdaExpression Accept(StackSpiller spiller)
8049 return spiller.Rewrite(
this);
8054 return new Expression<TDelegate>(body, name, tailCall, parameters);
Obtains information about the attributes of a member and provides access to member metadata.
sealed override Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
Represents an expression that has a constant value.
static BinaryExpression SubtractAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
static BinaryExpression LeftShift(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise left-shift operation.
static BinaryExpression Coalesce(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a coalescing operation.
Discovers the attributes of a parameter and provides access to parameter metadata.
static Type GetDelegateType(params Type[] typeArgs)
Gets a P:System.Linq.Expressions.Expression.Type object that represents a generic System....
abstract FieldInfo GetField(string name, BindingFlags bindingAttr)
Searches for the specified field, using the specified binding constraints.
static IndexExpression MakeIndex(Expression instance, PropertyInfo indexer, IEnumerable< Expression > arguments)
Creates an T:System.Linq.Expressions.IndexExpression that represents accessing an indexed property in...
static BinaryExpression ArrayIndex(Expression array, Expression index)
Creates a T:System.Linq.Expressions.BinaryExpression that represents applying an array index operator...
static BinaryExpression MultiplyAssignChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
static MethodCallExpression Call(Type type, string methodName, Type[] typeArguments, params Expression[] arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static (Shared i...
static ListInitExpression ListInit(NewExpression newExpression, params ElementInit[] initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses specified T:System....
A bitwise or logical OR operation, such as (a | b) in C# or (a Or b) in Visual Basic.
static SwitchExpression Switch(Expression switchValue, Expression defaultBody, MethodInfo comparison, IEnumerable< SwitchCase > cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement that has a de...
static UnaryExpression Increment(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the incrementing of the expressio...
A unary prefix decrement, such as (–a). The object a should be modified in place.
static UnaryExpression ArrayLength(Expression array)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an expression for obtaining the l...
static LabelTarget Label()
Creates a T:System.Linq.Expressions.LabelTarget representing a label with void type and no name.
static BinaryExpression Modulo(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic remainder operatio...
static ParameterExpression Variable(Type type)
Creates a T:System.Linq.Expressions.ParameterExpression node that can be used to identify a parameter...
bool IsLiteral
Gets a value indicating whether the value is written at compile time and cannot be changed.
Emits or clears a sequence point for debug information. This allows the debugger to highlight the cor...
static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static method th...
static BinaryExpression GreaterThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "greater than" numeric compari...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
static BinaryExpression DivideAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a division assignment operation ...
static BinaryExpression LeftShiftAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise left-shift assignment ...
static BinaryExpression NotEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an inequality comparison.
An addition compound assignment operation, such as (a += b), with overflow checking,...
An operation that creates a new T:System.Collections.IEnumerable object and initializes it from a lis...
A short-circuiting conditional OR operation, such as (a || b) in C# or (a OrElse b) in Visual Basic.
static LambdaExpression Lambda(Type delegateType, Expression body, params ParameterExpression[] parameters)
Creates a T:System.Linq.Expressions.LambdaExpression by first constructing a delegate type....
A multiplication compound assignment operation, such as (a *= b), that has overflow checking,...
static BlockExpression Block(IEnumerable< ParameterExpression > variables, params Expression[] expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given variables and expressions...
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static BinaryExpression Equal(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an equality comparison....
override Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
A conditional AND operation that evaluates the second operand only if the first operand evaluates to ...
bool IsStatic
Gets a value indicating whether the field is static.
An explicit reference or boxing conversion in which null is supplied if the conversion fails,...
abstract Type FieldType
Gets the type of this field object.
Represents an infinite loop. It can be exited with "break".
static BinaryExpression MultiplyAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, params Expression[] initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses a specified method to add elements t...
An division compound assignment operation, such as (a /= b), for numeric operands.
void Add(TKey key, TValue value)
Adds a key to the table.
static UnaryExpression PreIncrementAssign(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that increments the expression by 1 and assigns t...
abstract Type GetElementType()
When overridden in a derived class, returns the T:System.Type of the object encompassed or referred t...
static MethodCallExpression Call(MethodInfo method, params Expression[] arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static (Shared i...
static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method that take...
static CatchBlock Catch(ParameterExpression variable, Expression body, Expression filter)
Creates a T:System.Linq.Expressions.CatchBlock representing a catch statement with an T:System....
A subtraction compound assignment operation, such as (a -= b), that has overflow checking,...
Represents accessing a field or property.
static BinaryExpression Modulo(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic remainder operatio...
static UnaryExpression Convert(Expression expression, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a type conversion operation.
override bool Equals(object o)
Determines if the underlying system type of the current T:System.Type object is the same as the under...
abstract Type DeclaringType
Gets the class that declares this member.
static BinaryExpression GreaterThanOrEqual(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "greater than or equal" numeri...
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
static MemberInitExpression MemberInit(NewExpression newExpression, IEnumerable< MemberBinding > bindings)
Represents an expression that creates a new object and initializes a property of the object.
static GotoExpression Return(LabelTarget target, Expression value, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a return statement with the specified...
abstract MethodInfo GetGetMethod(bool nonPublic)
When overridden in a derived class, returns the public or non-public get accessor for this property.
static LambdaExpression Lambda(Expression body, bool tailCall, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
static BinaryExpression OrAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise OR assignment operatio...
Stores information necessary to emit debugging symbol information for a source file,...
A unary decrement operation, such as (a - 1) in C# and Visual Basic. The object a should not be modif...
static BinaryExpression RightShiftAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise right-shift assignment...
A list of run-time variables. For more information, see T:System.Linq.Expressions....
Discovers the attributes of a method and provides access to method metadata.
Type Type
The type of value that is passed when jumping to the label (or T:System.Void if no value should be pa...
Implements a T:System.IO.TextWriter for writing information to a string. The information is stored in...
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
Represents a constructor call.
static UnaryExpression Negate(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an arithmetic negation operation.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
static BinaryExpression SubtractAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
static BinaryExpression RightShiftAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise right-shift assignment...
Represents creating a new array and possibly initializing the elements of the new array.
static DefaultExpression Empty()
Creates an empty expression that has T:System.Void type.
A bitwise or logical AND compound assignment operation, such as (a &= b) in C#.
static BinaryExpression AddChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic addition operation...
virtual internal Expression VisitChildren(ExpressionVisitor visitor)
Reduces the node and then calls the visitor delegate on the reduced expression. The method throws an ...
Represents calling a constructor and initializing one or more members of the new object.
static UnaryExpression IsTrue(Expression expression, MethodInfo method)
Returns whether the expression evaluates to true.
static MethodCallExpression Call(Expression instance, MethodInfo method, params Expression[] arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method that take...
virtual bool ContainsGenericParameters
Gets a value indicating whether the generic method contains unassigned generic type parameters.
static BlockExpression Block(Type type, IEnumerable< ParameterExpression > variables, params Expression[] expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given variables and expressions...
static BinaryExpression PowerAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents raising an expression to a power...
Expression()
Constructs a new instance of T:System.Linq.Expressions.Expression.
static MemberExpression Property(Expression expression, Type type, string propertyName)
Creates a T:System.Linq.Expressions.MemberExpression accessing a property.
static BinaryExpression LeftShift(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise left-shift operation.
A unary postfix increment, such as (a++). The object a should be modified in place.
static UnaryExpression PostDecrementAssign(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the assignment of the expression ...
Discovers the attributes of a class constructor and provides access to constructor metadata.
static ConditionalExpression IfThenElse(Expression test, Expression ifTrue, Expression ifFalse)
Creates a T:System.Linq.Expressions.ConditionalExpression that represents a conditional block with if...
Represents a multicast delegate; that is, a delegate that can have more than one element in its invoc...
static BinaryExpression NotEqual(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an inequality comparison.
static BinaryExpression PowerAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents raising an expression to a power...
static TryExpression TryFinally(Expression body, Expression @finally)
Creates a T:System.Linq.Expressions.TryExpression representing a try block with a finally block and n...
Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived...
static GotoExpression Goto(LabelTarget target, Expression value, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a "go to" statement with the specifie...
static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
Discovers the attributes of a field and provides access to field metadata.
Represents a block that contains a sequence of expressions where variables can be defined.
abstract PropertyInfo [] GetProperties(BindingFlags bindingAttr)
When overridden in a derived class, searches for the properties of the current T:System....
static MemberInitExpression MemberInit(NewExpression newExpression, params MemberBinding[] bindings)
Creates a T:System.Linq.Expressions.MemberInitExpression.
A unary prefix increment, such as (++a). The object a should be modified in place.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
static GotoExpression Goto(LabelTarget target, Expression value)
Creates a T:System.Linq.Expressions.GotoExpression representing a "go to" statement....
static BinaryExpression LessThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "less than or equal" numeric c...
static BinaryExpression AddAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
static LambdaExpression Lambda(Type delegateType, Expression body, string name, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
virtual Type ReturnType
Gets the return type of this method.
static BinaryExpression OrElse(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a conditional OR operation that ...
static UnaryExpression Negate(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an arithmetic negation operation.
static MethodCallExpression Call(MethodInfo method, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static (Shared i...
static BinaryExpression Power(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents raising a number to a power.
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
Substitutes the elements of an array of types for the type parameters of the current generic method d...
static MemberExpression Property(Expression expression, string propertyName)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a property.
static BinaryExpression Subtract(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic subtraction operat...
static BinaryExpression Coalesce(Expression left, Expression right, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a coalescing operation,...
virtual internal Expression Accept(ExpressionVisitor visitor)
Dispatches to the specific visit method for this node type. For example, T:System....
static ConditionalExpression IfThen(Expression test, Expression ifTrue)
Creates a T:System.Linq.Expressions.ConditionalExpression that represents a conditional block with an...
static UnaryExpression IsFalse(Expression expression)
Returns whether the expression evaluates to false.
An arithmetic remainder compound assignment operation, such as (a %= b) in C#.
bool IsInitOnly
Gets a value indicating whether the field can only be set in the body of the constructor.
static GotoExpression Break(LabelTarget target, Expression value)
Creates a T:System.Linq.Expressions.GotoExpression representing a break statement....
Represents initializing the elements of a collection member of a newly created object.
Represents a label, which can be put in any T:System.Linq.Expressions.Expression context....
A "greater than or equal to" comparison, such as (a >= b).
Represents an expression that applies a delegate or lambda expression to a list of argument expressio...
A dynamic call site base class. This type is used as a parameter type to the dynamic site targets.
An unbox value type operation, such as unbox and unbox.any instructions in MSIL.
An arithmetic subtraction operation, such as (a - b), that has overflow checking, for numeric operand...
static BlockExpression Block(Type type, params Expression[] expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given expressions,...
A multiplication compound assignment operation, such as (a *= b), without overflow checking,...
A reference to a parameter or variable that is defined in the context of the expression....
int Count
Gets the number of elements contained in the T:System.Collections.ObjectModel.ReadOnlyCollection`1 in...
static SwitchExpression Switch(Expression switchValue, Expression defaultBody, params SwitchCase[] cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement that has a de...
static LabelExpression Label(LabelTarget target, Expression defaultValue)
Creates a T:System.Linq.Expressions.LabelExpression representing a label with the given default value...
static InvocationExpression Invoke(Expression expression, IEnumerable< Expression > arguments)
Creates an T:System.Linq.Expressions.InvocationExpression that applies a delegate or lambda expressio...
static UnaryExpression PostIncrementAssign(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the assignment of the expression ...
Generates debug information for lambda expressions in an expression tree.
static LambdaExpression Lambda(Expression body, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
static BinaryExpression MultiplyChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic multiplication ope...
ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
Searches for a constructor whose parameters match the specified argument types and modifiers,...
static UnaryExpression Decrement(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the decrementing of the expressio...
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static BinaryExpression Subtract(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic subtraction operat...
static UnaryExpression Not(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a bitwise complement operation.
Represents a value type that can be assigned null.
A mathematical operation that raises a number to a power, such as (a ^ b) in Visual Basic.
static BinaryExpression LessThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "less than" numeric comparison...
static NewExpression New(ConstructorInfo constructor, IEnumerable< Expression > arguments, params MemberInfo[] members)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the specified constructor w...
static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, IEnumerable< Expression > initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses a specified method to add elements t...
A loop, such as for or while.
Used to represent the target of a T:System.Linq.Expressions.GotoExpression.
static BinaryExpression ModuloAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a remainder assignment operation...
static GotoExpression Return(LabelTarget target)
Creates a T:System.Linq.Expressions.GotoExpression representing a return statement.
static BinaryExpression Multiply(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic multiplication ope...
static BinaryExpression RightShiftAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise right-shift assignment...
static LambdaExpression Lambda(Type delegateType, Expression body, string name, bool tailCall, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
A method call, such as in the obj.sampleMethod() expression.
Expression ReduceExtensions()
Reduces the expression to a known node type (that is not an Extension node) or just returns the expre...
static DebugInfoExpression ClearDebugInfo(SymbolDocumentInfo document)
Creates a T:System.Linq.Expressions.DebugInfoExpression for clearing a sequence point.
static BinaryExpression AddAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
static LambdaExpression Lambda(Expression body, params ParameterExpression[] parameters)
Creates a T:System.Linq.Expressions.LambdaExpression by first constructing a delegate type.
sealed override Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
static ElementInit ElementInit(MethodInfo addMethod, params Expression[] arguments)
Creates an T:System.Linq.Expressions.ElementInit, given an array of values as the second argument.
A bitwise left-shift operation, such as (a << b).
static BinaryExpression LessThan(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "less than" numeric comparison...
static UnaryExpression OnesComplement(Expression expression, MethodInfo method)
Returns the expression representing the ones complement.
static BinaryExpression MultiplyAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
An indexing operation in a one-dimensional array, such as array[index] in C# or array(index) in Visua...
bool IsStatic
Gets a value indicating whether the method is static.
static BinaryExpression ExclusiveOr(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise XOR operation,...
static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.BlockExpression that contains three expressions and has no variab...
A ones complement operation, such as (~a) in C#.
static BinaryExpression MultiplyChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic multiplication ope...
An arithmetic negation operation, such as (-a), that has overflow checking. The object a should not b...
PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
Searches for the specified property whose parameters match the specified argument types and modifiers...
static MethodCallExpression Call(MethodInfo method, Expression arg0)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static (Shared i...
A compound assignment operation that raises a number to a power, such as (a ^= b) in Visual Basic.
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
A bitwise or logical AND operation, such as (a & b) in C# and (a And b) in Visual Basic.
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static UnaryExpression Rethrow(Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a rethrowing of an exception with...
virtual bool IsSubclassOf(Type c)
Determines whether the current T:System.Type derives from the specified T:System.Type.
virtual int GetArrayRank()
Gets the number of dimensions in an array.
static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, params MemberBinding[] bindings)
Creates a T:System.Linq.Expressions.MemberMemberBinding that represents the recursive initialization ...
static MethodCallExpression ArrayIndex(Expression array, IEnumerable< Expression > indexes)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents applying an array index oper...
static SymbolDocumentInfo SymbolDocument(string fileName, Guid language, Guid languageVendor, Guid documentType)
Creates an instance of T:System.Linq.Expressions.SymbolDocumentInfo.
static Type GetActionType(params Type[] typeArgs)
Creates a T:System.Type object that represents a generic System.Action delegate type that has specifi...
An inequality comparison, such as (a != b) in C# or (a <> b) in Visual Basic.
bool IsByRef
Indicates that this ParameterExpression is to be treated as a ByRef parameter.
static BinaryExpression OrAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise OR assignment operatio...
static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static method th...
static SymbolDocumentInfo SymbolDocument(string fileName, Guid language, Guid languageVendor)
Creates an instance of T:System.Linq.Expressions.SymbolDocumentInfo.
static BinaryExpression DivideAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a division assignment operation ...
A bitwise right-shift compound assignment operation, such as (a >>= b).
static CatchBlock Catch(Type type, Expression body)
Creates a T:System.Linq.Expressions.CatchBlock representing a catch statement.
static UnaryExpression PreDecrementAssign(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that decrements the expression by 1 and assigns t...
static UnaryExpression Throw(Expression value, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a throwing of an exception with a...
virtual internal Expression VisitExtension(Expression node)
Visits the children of the extension expression.
static ParameterExpression Variable(Type type, string name)
Creates a T:System.Linq.Expressions.ParameterExpression node that can be used to identify a parameter...
static GotoExpression Return(LabelTarget target, Expression value)
Creates a T:System.Linq.Expressions.GotoExpression representing a return statement....
static UnaryExpression NegateChecked(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an arithmetic negation operation ...
static BinaryExpression Add(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic addition operation...
static BinaryExpression SubtractAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
virtual Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a closed generic type ...
override string ToString()
Returns a textual representation of the T:System.Linq.Expressions.Expression.
static BinaryExpression Power(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents raising a number to a power.
static UnaryExpression UnaryPlus(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a unary plus operation.
static UnaryExpression TypeAs(Expression expression, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an explicit reference or boxing c...
static MemberExpression PropertyOrField(Expression expression, string propertyOrFieldName)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a property or field.
A bitwise right-shift operation, such as (a >> b).
static ElementInit ElementInit(MethodInfo addMethod, IEnumerable< Expression > arguments)
Creates an T:System.Linq.Expressions.ElementInit, given an T:System.Collections.Generic....
An arithmetic remainder operation, such as (a % b) in C# or (a Mod b) in Visual Basic.
CallingConventions
Defines the valid calling conventions for a method.
static DebugInfoExpression DebugInfo(SymbolDocumentInfo document, int startLine, int startColumn, int endLine, int endColumn)
Creates a T:System.Linq.Expressions.DebugInfoExpression with the specified span.
static BinaryExpression PowerAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents raising an expression to a power...
new TDelegate Compile(DebugInfoGenerator debugInfoGenerator)
Produces a delegate that represents the lambda expression.
Attribute can be applied to a constructor.
static BinaryExpression MultiplyAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
Provides the base class from which the classes that represent bindings that are used to initialize me...
static UnaryExpression Not(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a bitwise complement operation....
Represents a globally unique identifier (GUID).To browse the .NET Framework source code for this type...
static BinaryExpression And(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise AND operation....
bool IsArray
Gets a value that indicates whether the type is an array.
static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable< ParameterExpression > parameters)
Creates a T:System.Linq.Expressions.LambdaExpression by first constructing a delegate type....
Provides the base class from which the classes that represent expression tree nodes are derived....
static CatchBlock Catch(ParameterExpression variable, Expression body)
Creates a T:System.Linq.Expressions.CatchBlock representing a catch statement with a reference to the...
static SwitchCase SwitchCase(Expression body, params Expression[] testValues)
Creates a T:System.Linq.Expressions.SwitchCase for use in a T:System.Linq.Expressions....
A subtraction compound assignment operation, such as (a -= b), without overflow checking,...
static bool TryGetActionType(Type[] typeArgs, out Type actionType)
Creates a P:System.Linq.Expressions.Expression.Type object that represents a generic System....
virtual bool CanReduce
Indicates that the node can be reduced to a simpler node. If this returns true, Reduce() can be calle...
static BinaryExpression AndAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise AND assignment operati...
static LoopExpression Loop(Expression body, LabelTarget @break, LabelTarget @continue)
Creates a T:System.Linq.Expressions.LoopExpression with the given body.
An addition operation, such as (a + b), with overflow checking, for numeric operands.
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
static BinaryExpression AddChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic addition operation...
static UnaryExpression Quote(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an expression that has a constant...
override string ToString()
Returns a string containing the characters written to the current StringWriter so far.
Represents an unconditional jump. This includes return statements, break and continue statements,...
static BinaryExpression SubtractAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
static ListInitExpression ListInit(NewExpression newExpression, params Expression[] initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses a method named "Add" to add elements...
An expression that provides runtime read/write permission for variables.
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
An multiplication operation, such as (a * b), that has overflow checking, for numeric operands.
MethodInfo Method
Gets the implementing method for the binary operation.
static MemberAssignment Bind(MethodInfo propertyAccessor, Expression expression)
Creates a T:System.Linq.Expressions.MemberAssignment that represents the initialization of a member b...
static readonly Type [] EmptyTypes
Represents an empty array of type T:System.Type. This field is read-only.
static SymbolDocumentInfo SymbolDocument(string fileName, Guid language)
Creates an instance of T:System.Linq.Expressions.SymbolDocumentInfo.
static UnaryExpression OnesComplement(Expression expression)
Returns the expression representing the ones complement.
static BinaryExpression And(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise AND operation.
static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression, given an operand, by calling the appropriate fac...
static MemberMemberBinding MemberBind(MemberInfo member, params MemberBinding[] bindings)
Creates a T:System.Linq.Expressions.MemberMemberBinding that represents the recursive initialization ...
static BinaryExpression Add(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic addition operation...
static TryExpression TryCatch(Expression body, params CatchBlock[] handlers)
Creates a T:System.Linq.Expressions.TryExpression representing a try block with any number of catch s...
static SwitchExpression Switch(Expression switchValue, params SwitchCase[] cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement without a def...
static LambdaExpression Lambda(Expression body, string name, bool tailCall, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
Expression(ExpressionType nodeType, Type type)
Initializes a new instance of the T:System.Linq.Expressions.Expression class.
static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression, given the left operand, right operand,...
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
static BlockExpression Block(IEnumerable< Expression > expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given expressions and has no va...
virtual bool IsGenericMethodDefinition
Gets a value indicating whether the method is a generic method definition.
Represents initializing members of a member of a newly created object.
static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, IEnumerable< MemberBinding > bindings)
Creates a T:System.Linq.Expressions.MemberMemberBinding that represents the recursive initialization ...
Enables compilers to dynamically attach object fields to managed objects.
static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.BlockExpression that contains four expressions and has no variabl...
static SwitchExpression Switch(Expression switchValue, Expression defaultBody, MethodInfo comparison, params SwitchCase[] cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement that has a de...
An operation that creates a new array, in which the bounds for each dimension are specified,...
static BinaryExpression GreaterThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "greater than or equal" numeri...
static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse, Type type)
Creates a T:System.Linq.Expressions.ConditionalExpression that represents a conditional statement.
static readonly MemberFilter FilterNameIgnoreCase
Represents the case-insensitive member filter used on names. This field is read-only.
Represents an initializer for a single element of an T:System.Collections.IEnumerable collection.
static BlockExpression Block(Type type, IEnumerable< ParameterExpression > variables, IEnumerable< Expression > expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given variables and expressions...
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static BinaryExpression AndAlso(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a conditional AND operation that...
static BinaryExpression OrAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise OR assignment operatio...
static BinaryExpression GreaterThan(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a "greater than" numeric compari...
virtual Type MakeArrayType()
Returns a T:System.Type object representing a one-dimensional array of the current type,...
static BinaryExpression Multiply(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic multiplication ope...
An arithmetic negation operation, such as (-a). The object a should not be modified in place.
static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression, given an operand and implementing method,...
A bitwise or logical XOR operation, such as (a ^ b) in C# or (a Xor b) in Visual Basic.
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
Expression< TDelegate > Update(Expression body, IEnumerable< ParameterExpression > parameters)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
static BinaryExpression RightShift(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise right-shift operation.
A "less than or equal to" comparison, such as (a <= b).
static BlockExpression Block(Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.BlockExpression that contains two expressions and has no variable...
A bitwise complement or logical negation operation. In C#, it is equivalent to (~a) for integral type...
static UnaryExpression PostDecrementAssign(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the assignment of the expression ...
static bool TryGetFuncType(Type[] typeArgs, out Type funcType)
Creates a P:System.Linq.Expressions.Expression.Type object that represents a generic System....
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
static UnaryExpression Rethrow()
Creates a T:System.Linq.Expressions.UnaryExpression that represents a rethrowing of an exception.
Represents a delegate, which is a data structure that refers to a static method or to a class instanc...
static LoopExpression Loop(Expression body, LabelTarget @break)
Creates a T:System.Linq.Expressions.LoopExpression with the given body and break target.
Represents type declarations: class types, interface types, array types, value types,...
static BinaryExpression AddAssignChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
Represents a constructor call that has a collection initializer.
static BinaryExpression MultiplyAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
static UnaryExpression IsTrue(Expression expression)
Returns whether the expression evaluates to true.
static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, params ParameterExpression[] parameters)
Creates a LambdaExpression by first constructing a delegate type.
A "less than" comparison, such as (a < b).
static NewExpression New(ConstructorInfo constructor)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the specified constructor t...
static GotoExpression Break(LabelTarget target, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a break statement with the specified ...
Provides information about methods and constructors.
bool IsPublic
Gets a value indicating whether this is a public method.
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
GotoExpressionKind Kind
The kind of the "go to" expression. Serves information purposes only.
static BinaryExpression MultiplyAssignChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a multiplication assignment oper...
Attribute can be applied to a method.
static SwitchCase SwitchCase(Expression body, IEnumerable< Expression > testValues)
Creates a T:System.Linq.Expressions.SwitchCase object to be used in a T:System.Linq....
static MethodCallExpression Call(Expression instance, string methodName, Type[] typeArguments, params Expression[] arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method by callin...
virtual Type MakeGenericType(params Type[] typeArguments)
Substitutes the elements of an array of types for the type parameters of the current generic type def...
static NewExpression New(ConstructorInfo constructor, params Expression[] arguments)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the specified constructor w...
static SwitchExpression Switch(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, params SwitchCase[] cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement that has a de...
static NewExpression New(Type type)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the parameterless construct...
An addition compound assignment operation, such as (a += b), without overflow checking,...
static RuntimeVariablesExpression RuntimeVariables(IEnumerable< ParameterExpression > variables)
Creates an instance of T:System.Linq.Expressions.RuntimeVariablesExpression.
static LoopExpression Loop(Expression body)
Creates a T:System.Linq.Expressions.LoopExpression with the given body.
Represents a control expression that handles multiple selections by passing control to T:System....
static MemberExpression Field(Expression expression, string fieldName)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a field given the name...
abstract string Name
Gets the name of the current member.
abstract MethodInfo GetSetMethod(bool nonPublic)
When overridden in a derived class, returns the set accessor for this property.
Represents a named parameter expression.
An operation that throws an exception, such as throw new Exception().
new TDelegate Compile()
Compiles the lambda expression described by the expression tree into executable code and produces a d...
static BinaryExpression AndAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise AND assignment operati...
static BinaryExpression Or(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise OR operation.
abstract Type PropertyType
Gets the type of this property.
Represents assignment operation for a field or property of an object.
bool IsValueType
Gets a value indicating whether the T:System.Type is a value type.
virtual CallingConventions CallingConvention
Gets a value indicating the calling conventions for this method.
Object()
Initializes a new instance of the T:System.Object class.
A node that represents a null coalescing operation, such as (a ?? b) in C# or If(a,...
static SwitchExpression Switch(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, IEnumerable< SwitchCase > cases)
Creates a T:System.Linq.Expressions.SwitchExpression that represents a switch statement that has a de...
static UnaryExpression Throw(Expression value)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a throwing of an exception.
static ParameterExpression Parameter(Type type, string name)
Creates a T:System.Linq.Expressions.ParameterExpression node that can be used to identify a parameter...
virtual Expression Visit(Expression node)
Dispatches the expression to one of the more specialized visit methods in this class.
A lambda expression, such as a => a + a in C# or Function(a) a + a in Visual Basic.
ExpressionType
Describes the node types for the nodes of an expression tree.
Selects a member from a list of candidates, and performs type conversion from actual argument type to...
MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
Searches for the specified method whose parameters match the specified argument types and modifiers,...
static UnaryExpression Unbox(Expression expression, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an explicit unboxing.
static GotoExpression Break(LabelTarget target, Expression value, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a break statement with the specified ...
override Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a generic method or th...
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
static MemberExpression Property(Expression expression, PropertyInfo property)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a property.
static MemberExpression Field(Expression expression, FieldInfo field)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a field.
static MethodCallExpression Call(Expression instance, MethodInfo method)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method that take...
Discovers the attributes of a property and provides access to property metadata.
static GotoExpression Goto(LabelTarget target, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a "go to" statement with the specifie...
static RuntimeVariablesExpression RuntimeVariables(params ParameterExpression[] variables)
Creates an instance of T:System.Linq.Expressions.RuntimeVariablesExpression.
static ListInitExpression ListInit(NewExpression newExpression, IEnumerable< ElementInit > initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses specified T:System....
static BlockExpression Block(params Expression[] expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given expressions and has no va...
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
static IndexExpression Property(Expression instance, string propertyName, params Expression[] arguments)
Creates an T:System.Linq.Expressions.IndexExpression representing the access to an indexed property.
A unary plus operation, such as (+a). The result of a predefined unary plus operation is the value of...
static UnaryExpression Convert(Expression expression, Type type, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a conversion operation for which ...
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
static BinaryExpression SubtractChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic subtraction operat...
static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[] arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static TypeBinaryExpression TypeEqual(Expression expression, Type type)
Creates a T:System.Linq.Expressions.TypeBinaryExpression that compares run-time type identity.
Represents one case of a T:System.Linq.Expressions.SwitchExpression.
static GotoExpression Continue(LabelTarget target)
Creates a T:System.Linq.Expressions.GotoExpression representing a continue statement.
The exception that is thrown when one of the arguments provided to a method is not valid.
An addition operation, such as a + b, without overflow checking, for numeric operands.
static BinaryExpression RightShift(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise right-shift operation.
static TypeBinaryExpression TypeIs(Expression expression, Type type)
Creates a T:System.Linq.Expressions.TypeBinaryExpression.
Represents an operation between an expression and a type.
static CatchBlock Catch(Type type, Expression body, Expression filter)
Creates a T:System.Linq.Expressions.CatchBlock representing a catch statement with an T:System....
static GotoExpression Goto(LabelTarget target)
Creates a T:System.Linq.Expressions.GotoExpression representing a "go to" statement.
static BinaryExpression OrElse(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a conditional OR operation that ...
static UnaryExpression ConvertChecked(Expression expression, Type type)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a conversion operation that throw...
static BinaryExpression Assign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an assignment operation.
static SymbolDocumentInfo SymbolDocument(string fileName)
Creates an instance of T:System.Linq.Expressions.SymbolDocumentInfo.
Represents a try/catch/finally/fault block.
virtual Expression Reduce()
Reduces this node to a simpler expression. If CanReduce returns true, this should return a valid expr...
An operation that invokes a delegate or lambda expression, such as sampleDelegate....
static UnaryExpression NegateChecked(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents an arithmetic negation operation ...
static IndexExpression ArrayAccess(Expression array, IEnumerable< Expression > indexes)
Creates an T:System.Linq.Expressions.IndexExpression to access a multidimensional array.
override Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
static NewArrayExpression NewArrayInit(Type type, IEnumerable< Expression > initializers)
Creates a T:System.Linq.Expressions.NewArrayExpression that represents creating a one-dimensional arr...
static LabelTarget Label(Type type)
Creates a T:System.Linq.Expressions.LabelTarget representing a label with the given type.
A unary increment operation, such as (a + 1) in C# and Visual Basic. The object a should not be modif...
static BinaryExpression LeftShiftAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise left-shift assignment ...
static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static method th...
static LambdaExpression Lambda(Expression body, string name, IEnumerable< ParameterExpression > parameters)
Creates a LambdaExpression by first constructing a delegate type.
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
sealed override ExpressionType NodeType
Returns the node type of this expression. Extension nodes should return F:System.Linq....
A switch operation, such as switch in C# or Select Case in Visual Basic.
static UnaryExpression IsFalse(Expression expression, MethodInfo method)
Returns whether the expression evaluates to false.
A division operation, such as (a / b), for numeric operands.
Represents the default value of a type or an empty expression.
static GotoExpression Continue(LabelTarget target, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a continue statement with the specifi...
Class responsible for runtime binding of the dynamic operations on the dynamic call site.
static BinaryExpression ReferenceEqual(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a reference equality comparison.
MethodInfo Method
Gets the implementing method for the unary operation.
static LabelExpression Label(LabelTarget target)
Creates a T:System.Linq.Expressions.LabelExpression representing a label without a default value.
A node that represents an equality comparison, such as (a == b) in C# or (a = b) in Visual Basic.
static BinaryExpression Divide(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic division operation...
Represents a dynamic operation.
static GotoExpression Break(LabelTarget target)
Creates a T:System.Linq.Expressions.GotoExpression representing a break statement.
static NewExpression New(ConstructorInfo constructor, IEnumerable< Expression > arguments, IEnumerable< MemberInfo > members)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the specified constructor w...
static BinaryExpression AddAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
A "greater than" comparison, such as (a > b).
static UnaryExpression PostIncrementAssign(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the assignment of the expression ...
static MemberExpression Field(Expression expression, Type type, string fieldName)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a field.
sealed override ExpressionType NodeType
Returns the node type of this Expression. Extension nodes should return F:System.Linq....
static ConstantExpression Constant(object value)
Creates a T:System.Linq.Expressions.ConstantExpression that has the P:System.Linq....
A bitwise or logical OR compound assignment, such as (a |= b) in C#.
An operation that creates a new one-dimensional array and initializes it from a list of elements,...
static UnaryExpression ConvertChecked(Expression expression, Type type, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a conversion operation that throw...
Expression ReduceAndCheck()
Reduces this node to a simpler expression. If CanReduce returns true, this should return a valid expr...
static CatchBlock MakeCatchBlock(Type type, ParameterExpression variable, Expression body, Expression filter)
Creates a T:System.Linq.Expressions.CatchBlock representing a catch statement with the specified elem...
static BinaryExpression SubtractChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic subtraction operat...
A binding that represents recursively initializing members of a member.
override bool CanReduce
Gets a value that indicates whether the expression tree node can be reduced.
static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a static method th...
static BlockExpression Block(Type type, IEnumerable< Expression > expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given expressions,...
static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers)
Creates a T:System.Linq.Expressions.MemberListBinding object based on a specified property accessor m...
A unary postfix decrement, such as (a–). The object a should be modified in place.
static TryExpression TryCatchFinally(Expression body, Expression @finally, params CatchBlock[] handlers)
Creates a T:System.Linq.Expressions.TryExpression representing a try block with any number of catch s...
A multiplication operation, such as (a * b), without overflow checking, for numeric operands.
static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression, given the left and right operands,...
An operation that obtains the length of a one-dimensional array, such as array.Length.
A bitwise or logical XOR compound assignment operation, such as (a ^= b) in C#.
Represents indexing a property or array.
static BinaryExpression AddAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
static Type GetFuncType(params Type[] typeArgs)
Creates a P:System.Linq.Expressions.Expression.Type object that represents a generic System....
Represents an expression that has a unary operator.
static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers)
Creates a T:System.Linq.Expressions.MemberListBinding where the member is a field or property.
Describes a lambda expression. This captures a block of code that is similar to a ....
static LambdaExpression Lambda(Expression body, bool tailCall, params ParameterExpression[] parameters)
Creates a LambdaExpression by first constructing a delegate type.
static BinaryExpression ExclusiveOr(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise XOR operation,...
static MemberExpression MakeMemberAccess(Expression expression, MemberInfo member)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing either a field or a pr...
new TDelegate Compile(bool preferInterpretation)
Compiles the lambda expression described by the expression tree into interpreted or compiled code and...
static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
Creates a T:System.Linq.Expressions.ConditionalExpression that represents a conditional statement.
virtual Type ParameterType
Gets the Type of this parameter.
static MethodCallExpression ArrayIndex(Expression array, params Expression[] indexes)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents applying an array index oper...
Represents a catch statement in a try block.
static BinaryExpression Equal(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an equality comparison.
static NewArrayExpression NewArrayBounds(Type type, IEnumerable< Expression > bounds)
Creates a T:System.Linq.Expressions.NewArrayExpression that represents creating an array that has a s...
static MethodCallExpression Call(Expression instance, MethodInfo method, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method that take...
Expression Body
Gets the body of this case.
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
static BinaryExpression Divide(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an arithmetic division operation...
static NewExpression New(ConstructorInfo constructor, IEnumerable< Expression > arguments)
Creates a T:System.Linq.Expressions.NewExpression that represents calling the specified constructor w...
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static NewArrayExpression NewArrayBounds(Type type, params Expression[] bounds)
Creates a T:System.Linq.Expressions.NewArrayExpression that represents creating an array that has a s...
Represents an expression that has a binary operator.
abstract MemberTypes MemberType
When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type ...
Specifies that instance members are to be included in the search.
static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers)
Creates a T:System.Linq.Expressions.NewArrayExpression that represents creating a one-dimensional arr...
static BinaryExpression LessThanOrEqual(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a " less than or equal" numeric ...
GotoExpressionKind
Specifies what kind of jump this T:System.Linq.Expressions.GotoExpression represents.
Represents a call to either static or an instance method.
Represents an expression that has a conditional operator.
string Name
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
static TryExpression MakeTry(Type type, Expression body, Expression @finally, Expression fault, IEnumerable< CatchBlock > handlers)
Creates a T:System.Linq.Expressions.TryExpression representing a try block with the specified element...
static BinaryExpression ModuloAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a remainder assignment operation...
static BinaryExpression DivideAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a division assignment operation ...
abstract bool CanWrite
Gets a value indicating whether the property can be written to.
static IndexExpression Property(Expression instance, PropertyInfo indexer, IEnumerable< Expression > arguments)
Creates an T:System.Linq.Expressions.IndexExpression representing the access to an indexed property.
static BinaryExpression ExclusiveOrAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise XOR assignment operati...
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...
Provides information about a specific culture (called a locale for unmanaged code development)....
static TryExpression TryFault(Expression body, Expression fault)
Creates a T:System.Linq.Expressions.TryExpression representing a try block with a fault block and no ...
static ListInitExpression ListInit(NewExpression newExpression, IEnumerable< Expression > initializers)
Creates a T:System.Linq.Expressions.ListInitExpression that uses a method named "Add" to add elements...
static BlockExpression Block(IEnumerable< ParameterExpression > variables, IEnumerable< Expression > expressions)
Creates a T:System.Linq.Expressions.BlockExpression that contains the given variables and expressions...
static BinaryExpression LeftShiftAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise left-shift assignment ...
static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression, given the left operand, right operand and imple...
bool IsByRef
Gets a value indicating whether the T:System.Type is passed by reference.
A subtraction operation, such as (a - b), without overflow checking, for numeric operands.
static MemberListBinding ListBind(MemberInfo member, IEnumerable< ElementInit > initializers)
Creates a T:System.Linq.Expressions.MemberListBinding where the member is a field or property.
MemberTypes
Marks each type of member that is defined as a derived class of T:System.Reflection....
static MemberAssignment Bind(MemberInfo member, Expression expression)
Creates a T:System.Linq.Expressions.MemberAssignment that represents the initialization of a field or...
sealed override ExpressionType NodeType
Returns the node type of this Expression. Extension nodes should return F:System.Linq....
static BinaryExpression SubtractAssignChecked(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
static UnaryExpression Decrement(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the decrementing of the expressio...
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
An operation that creates a new object and initializes one or more of its members,...
static IndexExpression ArrayAccess(Expression array, params Expression[] indexes)
Creates an T:System.Linq.Expressions.IndexExpression to access an array.
static BinaryExpression ModuloAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a remainder assignment operation...
An operation that calls a constructor to create a new object, such as new SampleType().
static BinaryExpression AndAlso(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a conditional AND operation that...
static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4)
Creates a T:System.Linq.Expressions.BlockExpression that contains five expressions and has no variabl...
virtual Type MakeByRefType()
Returns a T:System.Type object that represents the current type when passed as a ref parameter (ByRef...
static IndexExpression Property(Expression instance, PropertyInfo indexer, params Expression[] arguments)
Creates an T:System.Linq.Expressions.IndexExpression representing the access to an indexed property.
Provides atomic operations for variables that are shared by multiple threads.
virtual Type Type
Gets the static type of the expression that this T:System.Linq.Expressions.Expression represents.
virtual string Name
Gets the name of the parameter.
static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable< ElementInit > initializers)
Creates a T:System.Linq.Expressions.MemberListBinding based on a specified property accessor method.
override bool CanReduce
Gets a value that indicates whether the expression tree node can be reduced.
static GotoExpression Return(LabelTarget target, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a return statement with the specified...
static BinaryExpression AndAssign(Expression left, Expression right, MethodInfo method)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise AND assignment operati...
static ConstantExpression Constant(object value, Type type)
Creates a T:System.Linq.Expressions.ConstantExpression that has the P:System.Linq....
static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression value, Type type)
Creates a T:System.Linq.Expressions.GotoExpression representing a jump of the specified T:System....
abstract bool CanRead
Gets a value indicating whether the property can be read.
virtual bool IsAssignableFrom(Type c)
Determines whether an instance of a specified type can be assigned to an instance of the current type...
Represents a visitor or rewriter for expression trees.
bool TryGetValue(TKey key, out TValue value)
Gets the value of the specified key.
static UnaryExpression PreDecrementAssign(Expression expression, MethodInfo method)
Creates a T:System.Linq.Expressions.UnaryExpression that decrements the expression by 1 and assigns t...
static BinaryExpression AddAssignChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents an addition assignment operation...
static Delegate CreateDelegate(Type type, object target, string method)
Creates a delegate of the specified type that represents the specified instance method to invoke on t...
An assignment operation, such as (a = b).
override bool CanReduce
Gets a value that indicates whether the expression tree node can be reduced.
static DefaultExpression Default(Type type)
Creates a T:System.Linq.Expressions.DefaultExpression that has the P:System.Linq.Expressions....
static InvocationExpression Invoke(Expression expression, params Expression[] arguments)
Creates an T:System.Linq.Expressions.InvocationExpression that applies a delegate or lambda expressio...
static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
Creates a T:System.Linq.Expressions.DynamicExpression that represents a dynamic operation bound by th...
static LabelTarget Label(Type type, string name)
Creates a T:System.Linq.Expressions.LabelTarget representing a label with the given type and name.
An expression that has a constant value of type T:System.Linq.Expressions.Expression....
A bitwise left-shift compound assignment, such as (a <<= b).
static ParameterExpression Parameter(Type type)
Creates a T:System.Linq.Expressions.ParameterExpression node that can be used to identify a parameter...
static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1)
Creates a T:System.Linq.Expressions.MethodCallExpression that represents a call to a method that take...
static UnaryExpression UnaryPlus(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents a unary plus operation.
static BinaryExpression ExclusiveOrAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise XOR assignment operati...
static BinaryExpression SubtractAssignChecked(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a subtraction assignment operati...
ReadOnlyCollection< Expression > TestValues
Gets the values of this case. This case is selected for execution when the P:System....
static UnaryExpression Increment(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that represents the incrementing of the expressio...
static BinaryExpression ReferenceNotEqual(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a reference inequality compariso...
static UnaryExpression PreIncrementAssign(Expression expression)
Creates a T:System.Linq.Expressions.UnaryExpression that increments the expression by 1 and assigns t...
static BinaryExpression Or(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise OR operation.
static MemberExpression Property(Expression expression, MethodInfo propertyAccessor)
Creates a T:System.Linq.Expressions.MemberExpression that represents accessing a property by using a ...
static LabelTarget Label(string name)
Creates a T:System.Linq.Expressions.LabelTarget representing a label with void type and the given nam...
static MemberMemberBinding MemberBind(MemberInfo member, IEnumerable< MemberBinding > bindings)
Creates a T:System.Linq.Expressions.MemberMemberBinding that represents the recursive initialization ...
static BinaryExpression ExclusiveOrAssign(Expression left, Expression right)
Creates a T:System.Linq.Expressions.BinaryExpression that represents a bitwise XOR assignment operati...