473,385 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using DynamicInvoke, Delegate Covariance and Contravariance in VB.

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
Jun 10 '07 #1
1 2987
herbert <he*****@discussions.microsoft.comwrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Todd Schinell | last post by:
Back in July, Jeffery Tan posted this: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OWOTdf0VDHA.2296%40cpmsftngxa06.phx.gbl In response as to how to get click events from a...
3
by: Oscar Thornell | last post by:
Hi, I am thinking about doing all my logging asynchronously using a delegate. The main resaon for this would be performance and responsiveness of the application (an ASP.NET app). //Exampel...
1
by: Geraldine Hobley | last post by:
Hello, I would like to invoke an event using a delegate or any other way. I have declared a delegate as below with the same signature as the event I wish to invoke. Delegate Sub...
3
by: Jon | last post by:
I am a little problem deciding when to use delegates and when not to. Is the following a good example? I have an order class and a messenger class (this does things like send emails, pages,...
1
by: Terry Olsen | last post by:
I'm using the SciLexer.dll to write a code editor for an in-house scripting language. I have the editor window up on a form but I need to use it's API. I've used the following commands to load the...
1
by: someone help | last post by:
hi, i am very new in the software field. i have two child forms. i want two display image in picture box in one child form. when test is completed this image is displayed. i created one class and...
4
by: raylopez99 | last post by:
What are these terms in my header anyway? But more importantly for me, look at this code: Lack of variance: why a List<Bananaisn’t a List<Fruit> Many people initially expect the following...
6
by: Charles Law | last post by:
I have a base class and derived classes that relate to a set of documents I process. e.g. DocBase, DocA, DocB, DocC. The processing of each document is handled in teh derived classes, as you might...
10
by: vcquestions | last post by:
Hi. Is there way to have a function pointer to a delegate in c++/cli that would allow me to pass delegates with the same signatures as parameters to a method? I'm working with managed code. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.