Assuming Invoke
tries to call the delegate dynamically, you should be able to wrap the input array in another
private void Invoke(Action<Control[]> act, Control[] elements)
{
act.DynamicInvoke(new object[] { elements });
}
This issue is caused by array covariance, since you can do
Control[] elements = ...
object[] arr = elements;
so the input Control[]
can be passed directly to Invoke
, which results in each array elements being passed separately to the method.