I have been trying to figure this out and it's really bugging me. I have some code that looks like this
static T MyFunction<T>(Func<T> action, int i, int i2)
{
...some code here
}
When I need to call this code I tried this
var result = MyFunction<List<string>>(MethodThatReturnsListofString(int number), 1,2)
It fails stating that the best overload has invalid arguments But when I tried the following
var result = MyFunction<List<string>>(() => MethodThatReturnsListofString(int number), 1,2)
It works fine. What is the function of "() =>" in this case. I thought() could not be used with methods required more than 0 args.