.net - C# callbacks not working -
.net - C# callbacks not working -
i'm defining function takes function parameter (using microsoft (r) visual c# 2005 compiler version 8.00.50727.4927) weird error.
here's function definition:
public managementscope connectcomputerwmi(string computername, string username, string password, action callbackprocessend) {... }
and here's error:
error cs0305: using generic type 'system.action<t>' requires '1' type arguments
i'm not sure type system.action needs.
the error message makes doesn't know non-generic action
delegate, , reason can think of you're targeting .net 2.0. in .net 2.0, action<t>
existed; more versions introduced in .net 3.5, , more in .net 4.
edit: i've seen you're using visual studio 2005 - means are targeting .net 2.0. (did have previous version of question specified .net 4? have sworn did...)
that's problem... there various solutions. could declare own delegate:
public delegate void action();
or could utilize methodinvoker
or (which has equivalent signature, unfortunately in windows forms namespace - not ideal if you're not using windows forms)...
or upgrade more modern version of visual studio , .net.
c# .net
Comments
Post a Comment