I am new to c#. I am trying to declare a delegate function which takes 2 generics inputs.
I am having problems compile it. can anyone tell me what is the problem here.
delegate int ippcFuncPtr<in T1, in T2>(T1 param, T2 returnval);
static int ippcServerRegisterProcedure(int handle,
string procedureName, ippcFuncPtr<in T1, in T2> procedure)
{
return 0;
}
Thanks,
Eyal
You don’t need to redeclare the contravariance in the parameter, but you do need to give the method type parameters, unless it’s in a generic type:
I’d also strongly recommend that you follow .NET naming conventions – and use the standard delegates where possible… so in this case: