Oddeleguj delegata do Func w C #
Mam kod:
public delegate int SomeDelegate(int p);
public static int Inc(int p) {
return p + 1;
}
Mogę rzucićInc
doSomeDelegate
lubFunc<int, int>
:
SomeDelegate a = Inc;
Func<int, int> b = Inc;
ale nie mogę rzucićInc
doSomeDelegate
i po tym rzucić naFunc<int, int>
w zwykły sposób:
Func<int, int> c = (Func<int, int>)a; // Сompilation error
Jak mogę to zrobić?