Suppose I have the following code:
delegate int MyDel (int n); // my delegate static int myMethod( MyDel lambda, int n) { n *= n; n = lambda(n); return n; // returns modified n }
Thus, having a different lambda expression, I can customize the method output.
myMethod ( x => x + 1, 5); myMethod ( x => x - 1, 5);
Now, if I don't want to do any arrhythmic expressions in a lambda expression, I could use:
myMethod ( x => x, 5);
My question is: is there a way to use lambda expresion with additional params properties? Maybe somehow embed my delegate into an array?
static int myMethod (int n, params MyDel lambda) {
source share