Does delegate instantiate an instance of Delegate or MultiCastDele

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

Guest

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 generate a new delegate class named
CheckAndPrintDelegate that inherits from System.MulticastDelegate.

Elsewhere it says the same delegate definition produces a delegate class
inheriting from System.Delegate.

Under what condition does this construct create an instance of
System.Delegate and under what condition does it create an instance of
System.MulticastDelegate?

Thanks

Nima Dilmaghani
 
Hi,
the complete explanation to your question is this :
http://209.34.241.67/brada/archive/2004/2/5.aspx. You see there that we can
never inherit from system.delegate directly. Since Brad said that we should
pretend that only multicastdelegate exists so this means that always an
instance of multicastdelegate is created for us, & because its internally
inheriting from system.delegate so while wrting it would be valid to say that
its an instance of system.delegate, but its actually system.multicastdelegate.

Regards,

Abubakar.
http://joehacker.blogspot.com
 
Thanks Abubakar. It is now clear.

Abubakar said:
Hi,
the complete explanation to your question is this :
http://209.34.241.67/brada/archive/2004/2/5.aspx. You see there that we can
never inherit from system.delegate directly. Since Brad said that we should
pretend that only multicastdelegate exists so this means that always an
instance of multicastdelegate is created for us, & because its internally
inheriting from system.delegate so while wrting it would be valid to say that
its an instance of system.delegate, but its actually system.multicastdelegate.

Regards,

Abubakar.
http://joehacker.blogspot.com
 
Back
Top