delegates and typed datasets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have this delegate: public delegate DataSet TestDelegate1(string code);
But when I try to pass methods that return a typed dataset instead of a
regular dataset I get an error saying the method does not match the delegate.
Is there a way around that?

Thanks.
 
Hi,

AFAIk the signature should be exact , think what would happen if you have
another delegate with the typed dataset as the return type, at compile time
which one to use?

the solution is fast though , just create another method with the correct
signature and make it return the correct type, like this

DataSet wrapper( string code)
{
return realMethod( code);
}

where realMethod return the typed dataset.


cheers,
 
Ok, thanks!

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

AFAIk the signature should be exact , think what would happen if you have
another delegate with the typed dataset as the return type, at compile time
which one to use?

the solution is fast though , just create another method with the correct
signature and make it return the correct type, like this

DataSet wrapper( string code)
{
return realMethod( code);
}

where realMethod return the typed dataset.


cheers,
 
Back
Top