In addition to the correct Solution 1:
You don't need a separate delegate type declaration for such a simple signature; it is already done for you and is
System.Func<int, int, int>
. You don't need a separate type declaration at all:
System.Func<int, int, int> ed = new System.Func<int, int, int>(Demo.Mul);
Moreover, you don't even need a separate (named) method implementation:
System.Func<int, int, int> ed = new System.Func<int, int, int>( (x, y) => {
return x * y;
});
The special feature of using lambda: you can make the like shown above local in some method, not exposed anywhere else. Why would you need such a thing? For just one thing, please see my short article:
Hide Ad-hoc Methods Inside the Calling Method’s Body[
^].
—SA