Let us suppose that I have two functions like:
public T Foo<T>(Func<T> func){
return func();
}
public TResult Foo<T, TResult>(Func<T, TResult> func, T param){
return func(param);
}
And I have the following code to execute:
someObj.someMethod(someParam);
Which approach is preferable, and what is the difference?
var foo = Foo(() => someObj.someMethod(someParam));
or
var foo = Foo(someObj.someMethod, someParam);
1st approach seems to be more preferable.
Foo(() => someObj.someMethod(someParam));
As someParam is related to someMethod more than Foo.