473,396 Members | 2,109 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,396 software developers and data experts.

MultiCastDelegate

MB
Hi,

I got following :

' This delegate is declared as a void, so the compiler automatically
' generates a new class, named CheckAndPrintDelegate, that inherits from
' System.MulticastDelegate

from :
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemMulticastDelegateClassTopic.asp

But how do you inherit from a multicast delegate ?
When I try this, I get following error: cannot inherit from special class
'System.MulticastDelegate'

Don't understand that multicast thingy all to good :)

thanks
Nov 16 '05 #1
8 4092
Hi,

Delegates are internally classes which the compiler generates. These
classes derive from System.Delegate (if there the delegate has a return
value) or System.MulticastDelegate (if there are no return values).

You are not supposed to use these classes in your code.

Let me know if you need more assistance.

HTH,
Rakesh Rajan

"MB" wrote:
Hi,

I got following :

' This delegate is declared as a void, so the compiler automatically
' generates a new class, named CheckAndPrintDelegate, that inherits from
' System.MulticastDelegate

from :
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemMulticastDelegateClassTopic.asp

But how do you inherit from a multicast delegate ?
When I try this, I get following error: cannot inherit from special class
'System.MulticastDelegate'

Don't understand that multicast thingy all to good :)

thanks

Nov 16 '05 #2
delegates *always* derive from System.MulticastDelegate whether they have a return type or not. When you fire a delegate that has a return type and has multiple targets you only see the result from the last invocation. To see all the results you have to process the calls manually via GetInvocationList()

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

Delegates are internally classes which the compiler generates. These
classes derive from System.Delegate (if there the delegate has a return
value) or System.MulticastDelegate (if there are no return values).

You are not supposed to use these classes in your code.

Let me know if you need more assistance.

HTH,
Rakesh Rajan

Nov 16 '05 #3
Hi Richard,

I agree that this is indeed the case as is evident in the IL.

But ideally, I don't feel this should be the case. I feel that it should be
the way as described in the MSDN page @
http://msdn.microsoft.com/library/de...ClassTopic.asp

But for some reason, it seems it is not as is documented.

HTH,
Rakesh Rajan

"Richard Blewett [DevelopMentor]" wrote:
delegates *always* derive from System.MulticastDelegate whether they have a return type or not. When you fire a delegate that has a return type and has multiple targets you only see the result from the last invocation. To see all the results you have to process the calls manually via GetInvocationList()

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

Delegates are internally classes which the compiler generates. These
classes derive from System.Delegate (if there the delegate has a return
value) or System.MulticastDelegate (if there are no return values).

You are not supposed to use these classes in your code.

Let me know if you need more assistance.

HTH,
Rakesh Rajan

Nov 16 '05 #4
There were two types of delegates in beta 1 of 1.0 but then they realised a single target delegate was really only a multicast delegate with only one entry in its invocation list and so simplified the model to what you see today.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi Richard,

I agree that this is indeed the case as is evident in the IL.

But ideally, I don't feel this should be the case. I feel that it should be
the way as described in the MSDN page @: http://msdn.microsoft.com/library/de...ClassTopic.asp

But for some reason, it seems it is not as is documented.

HTH,
Rakesh Rajan

Nov 16 '05 #5
Hi,

Thanks Richard, for the extra info.

Hmm...so shouldn't they be updating the documentation?

Regards,
Rakesh Rajan

"Richard Blewett [DevelopMentor]" wrote:
There were two types of delegates in beta 1 of 1.0 but then they realised a single target delegate was really only a multicast delegate with only one entry in its invocation list and so simplified the model to what you see today.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi Richard,

I agree that this is indeed the case as is evident in the IL.

But ideally, I don't feel this should be the case. I feel that it should be
the way as described in the MSDN page @: http://msdn.microsoft.com/library/de...ClassTopic.asp

But for some reason, it seems it is not as is documented.

HTH,
Rakesh Rajan

Nov 16 '05 #6
I don't think the documentation is wrong - well not from my reading of it. Which passage are you refering to and how do you interpret it?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

Thanks Richard, for the extra info.

Hmm...so shouldn't they be updating the documentation?

Regards,
Rakesh Rajan
Nov 16 '05 #7
Hi,

It's in the source code comments they are referring to this.

Quoting it:
' This delegate is declared as a void, so the compiler automatically
' generates a new class, named CheckAndPrintDelegate, that inherits from
' System.MulticastDelegate.
' If this delegate were declared with a Boolean return value, it
' would inherit from System.Delegate and be a singlecast delegate.

Regards,
Rakesh Rajan

"Richard Blewett [DevelopMentor]" wrote:
I don't think the documentation is wrong - well not from my reading of it. Which passage are you refering to and how do you interpret it?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

Thanks Richard, for the extra info.

Hmm...so shouldn't they be updating the documentation?

Regards,
Rakesh Rajan

Nov 16 '05 #8
Yep - that definitely needs changing - good spot

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

It's in the source code comments they are referring to this.

Quoting it:
' This delegate is declared as a void, so the compiler automatically
' generates a new class, named CheckAndPrintDelegate, that inherits from
' System.MulticastDelegate.
' If this delegate were declared with a Boolean return value, it
' would inherit from System.Delegate and be a singlecast delegate.

Regards,
Rakesh Rajan

Nov 16 '05 #9

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

Similar topics

3
by: Edward Diener | last post by:
I am surprised that a MulticastDelegate does not have a particular member function which checks if a particular delegate is in its invocation list. I can do this manually of course but a Find, or...
1
by: Nima | last post by:
The documentation for the Delegate and the MultiCastDelegate classes tell me that when we have a line like: public delegate void CheckAndPrintDelegate(string str); it causes the compiler to...
3
by: SW Prathap | last post by:
hi how to capture return value of MulticastDelegate. swp
1
by: Darren | last post by:
Why can I cast an event I declare but not one defined in the Form class public event System.EventHandler MyEvent; private void SomeFn() { MulticastDelegate d1 =...
2
by: Nima | last post by:
The documentation for the Delegate and the MultiCastDelegate classes tell me that when we have a line like: public delegate void CheckAndPrintDelegate(string str); it causes the compiler to...
4
by: Edward Diener | last post by:
Does the += notation for adding delegates to a delegate pointer object work even if the delegate pointer is 0 ? As an example: __gc class SomeObjectClass { public: void SomeObjectMethod() { } };...
1
by: Quimbly | last post by:
I'm having some problems comparing delegates. In all sample projects I create, I can't get the problem to occur, but there is definitely a problem with my production code. I can't give all the...
2
by: kristian.freed | last post by:
Hi, I currently work in a project written fully in C# where we make extensive use of delegates and events. We have a model where a "state", an object holding data but not much code but which...
69
by: raylopez99 | last post by:
They usually don't teach you in most textbooks I've seen that delegates can be used to call class methods from classes that are 'unaware' of the delegate, so long as the class has the same...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.