You can only convert from lambda expressions to specific types of delegates. In this particular case, it is really easy - you can simply use Action instead (or MethodInvoker or any delegate type without parameters and the return type is void ):
if (this.InvokeRequired) { this.Invoke((Action) (() => this.CheckVersionInfo())); }
Or just use method group conversion to simplify:
if (this.InvokeRequired) { this.Invoke((Action)CheckVersionInfo); }
Alternatively, add an extension method to Control or ISynchronizeInvoke either add the Invoke(Action) method or the check and invoke method. (Both can be useful in different contexts.)
To be honest, I would be very nervous from the rest of the code you import if it is mostly broken like that. If the code is not even compiled to begin with, how much confidence do you have that it will work after fixing the most obvious errors?
Note that this is not just a question of different versions of C # or something like that - the code you posted would never work in any version of C #.
source share