Hello all,
The Form.Invoke method is waiting for a delegate as parameter.
I wanted to use an anonymous method instead of a delegate but I receive a compilation error :
Cannot convert from 'anonymous method' to 'System.Delegate'
I find this quite strange as an anonymous method will be generated as a delegate in MSIL and so as class of type System.MulticastDelegate. So i think it should be able to convert it.
Is it because it doesn't know the signature of the delegate it must build or for another reason
If it's because of that, I was wondering if this will be solved with type inference of C# or not.
Thanks,
Pierre-Emmanuel Dautreppe

Cannot convert from 'anonymous method' to 'System.Delegate'
David Murray
Exactly, you need a specific delegate type so the signature is known. Type inferencing can't help you here since the parameter type is Delegate. Delegate and MulticastDelegate are both abstract classes that you can't instantiate.