using DynamicInvoke, Delegate Covariance and Contravariance in VB.

G

Guest

Jon Skeet wrote in the .NET general newsgroup 11/17/2005:
"The difference between Invoke and DynamicInvoke is that the parameters
to Invoke depend on the delegate itself - the method has the same
signature as the delegate. DynamicInvoke has a "fixed" signature, and
it dynamically calls Invoke with the appropriate parameters."

So far I have seen DynamicInvoke only used in conjunction with generics
event arguments. Is there any other usage?

When do I need to use DynamicInvoke?

What is the relation of DynamicInvoke, Delegate Covariance and Contravariance?

Given the fact that Covariance and Contravariance are not supported in
VB.NET (there is a workaround by Francesco Balena in his VB.2005 book), is it
worth any effort; ie. does it reduce my code size?

thank you very much
herbert
 
J

Jon Skeet [C# MVP]

herbert said:
Jon Skeet wrote in the .NET general newsgroup 11/17/2005:
"The difference between Invoke and DynamicInvoke is that the parameters
to Invoke depend on the delegate itself - the method has the same
signature as the delegate. DynamicInvoke has a "fixed" signature, and
it dynamically calls Invoke with the appropriate parameters."

So far I have seen DynamicInvoke only used in conjunction with generics
event arguments. Is there any other usage?

Well, there may be some, but I can't say I remember ever using it.
When do I need to use DynamicInvoke?

That's a very tricky question to answer - I would just try to know
about it and then you can use it if you ever get into a situation where
there are no better solutions.
What is the relation of DynamicInvoke, Delegate Covariance and Contravariance?

None that I can think of off the top of my head. There may be some use
for it which gives a form of covariance/contravariance, but I haven't
seen one myself.
Given the fact that Covariance and Contravariance are not supported in
VB.NET (there is a workaround by Francesco Balena in his VB.2005 book), is it
worth any effort; ie. does it reduce my code size?

That would entirely depend on what you're doing with delegates. A lot
of code will never want delegate covariance/contravariance anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top