views:

104

answers:

2

I am looking for something like Action but I want it to be

delegate U ReturnAction<T,U>(T param);

Is there already a system delegate for this? I just don't want to reinvent the wheel. I did the same thing when I first needed a Predicate and then realized it existed.

+11  A: 

i think you need

Func<T, TRet>

It has various overloads

Func<TRet>
Func<T, TRet>
Func<T1, T2, TRet>
Func<T1, T2, T3, TRet>
Jhonny D. Cano -Leftware-
wow, I'm getting old, thats exactly what I wanted. I knew it existed but had a total brainfart.
DevelopingChris
jejej that was an easy one !!
Jhonny D. Cano -Leftware-
+5  A: 

Take a look at Func

delegate TReturn Func<T1,TReturn>(T1 arg1);

The 3.5 framework contains several overloads of func. From 0 to 4 arguments are defined.

JaredPar