Can I have an Action<> or Func<> with an out param?

Viewed 21101

I have a method with an out parameter, and I'd like to point an Action or Func (or other kind of delegate) at it.

This works fine:

static void Func(int a, int b) { }
Action<int,int> action = Func;

However this doesn't

static void OutFunc(out int a, out int b) { a = b = 0; }
Action<out int, out int> action = OutFunc; // loads of compile errors

This is probably a duplicate, but searching for 'out parameter' isn't particularly fruitful.

2 Answers
Related