Using a out parameter in Func Delegate

c#-4.0, delegates, func

Solution

You are just written answer.

If you in .net 4.0 or above you can specify variance for parameters.

public delegate TV MyFunc<in T, TU, out TV>(T input, out TU output);

Then use:

bool TryGetItem(string itemKey,out Item item);

MyFunc<string, Item, bool> func = TryGetItem;

Problem

I have a method signature ``` bool TryGetItem(string itemKey,out Item item) ``` How can i encapsulate this signature in ``` delegate V Func<T,U,V>(T input, out U output) ``` as in the post: Func<T> with out parameter ?

Original source

Related problems