I have code:
public delegate int SomeDelegate(int p);
public static int Inc(int p) {
return p + 1;
}
I can cast Inc
to SomeDelegate
or Func<int, int>
:
SomeDelegate a = Inc;
Func<int, int> b = Inc;
but I can't cast Inc
to SomeDelegate
and after that cast to Func<int, int>
with usual way like this:
Func<int, int> c = (Func<int, int>)a; // Сompilation error
How I can do it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…