Consider the following pseudo code:
TResult Foo<TResult>(Func<T1, T2,...,Tn, TResult> f, params object[] args)
{
TResult result = f(args);
return result;
}
The function accepts Func<>
with unknown number of generic parameters and a list of the corresponding arguments. Is it possible to write it in C#? How to define and call Foo
? How do I pass args
to f
?