-
Notifications
You must be signed in to change notification settings - Fork 30
Arguments
MilleBo edited this page Jan 29, 2017
·
2 revisions
ValueArgument
VariableArgument
InvocationArgument
ReferenceArgument
ClassInitializationArgument
ArrayInitializationArgument
DictionaryInitializationArgument
TypeOfArgument
ParenthesizedLambdaArgument
BinaryExpressionArgument
Statement.Expression.Invoke("Method", new List<IArgument> { new ValueArgument(1) });
Method(1);
Statement.Expression.Invoke("Method", new List<IArgument> { new VariableArgument("myVariable") });
Method(myVariable);
Statement.Expression.Invoke("Method", new List<IArgument> { new InvocationArgument(new MethodReference("Do")) });
Method(Do());
Statement.Expression.Invoke("Method", new List<IArgument> { new ReferenceArgument(new VariableReference("i", new MemberReference("MyProperty"))) });
Method(i.MyProperty);
Statement.Expression.Invoke("Method", new List<IArgument> { new ClassInitializationArgument(typeof(List<int>))) });
Method(new List<int>());
Statement.Expression.Invoke("Method", new List<IArgument> { new ArrayInitializationArgument(typeof(int), new List<IArgument>() { new ValueArgument(1), new ValueArgument(2)}) });
Method(new int[] {1, 2});
Statement.Expression.Invoke("Method", new List<IArgument> { new DictionaryInitializationArgument<int, int>(new Dictionary<int, IArgument>() { [1] = new ValueArgument(2)})});
Method(new Dictionary<int,int>{ [1] = 2});
Statement.Expression.Invoke("Method", new List<IArgument> { new TypeOfArgument(typeof(int))});
Method(typeof(int));
Statement.Expression.Invoke("Method", new List<IArgument> { new ParenthesizedLambdaArgument(Statement.Expression.Invoke(new MethodReference("Do").AsExpression())});
Method(() => Do());
Statement.Expression.Invoke("Method", new List<IArgument> { new BinaryExpressionArgument(new MathBinaryExpression(new ConstantReference(1), new ConstantReference(2), MathOperators.Add ))});
Method(1+2);