Consider the delegate for a generic A
to B
function:
public delegate B Fun<A, B>(A x);
I can then write a function that accepts and invokes the Fun
delegate:
public static B invokeFun<A, B>(A x, Fun<A, B> f)
{ return f(x); }
(Never mind whether it is wise to write invokeFun
.)
Can I write invokeFun
without naming the Fun
delegate? I would expect something like this to work, but it doesn't:
public static B invokeFun<A, B>(A x, B (A) f)
{ return f(x); }