-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: s_hashim
Message 6 in Discussion

Delegates enable scenarios that some other languages have addressed with
function pointers. However, unlike function pointers, delegates are
object-oriented and type-safe. 
A delegate declaration defines a class that is derived from the class
System.Delegate. A delegate instance encapsulates an invocation list, which
is a list of one or more methods, each of which is referred to as a callable
entity. For instance methods, a callable entity consists of an instance and
a method on that instance. For static methods, a callable entity consists of
just a method. Invoking a delegate instance with an appropriate set of
arguments causes each of the delegate instance's callable entities to be
invoked with the given set of arguments.
An interesting and useful property of a delegate instance is that it does
not know or care about the classes of the methods it encapsulates; all that
matters is that those methods be compatible (Section 15.1)
<vclrfcsharpspec_15_1.htm> with the delegate's type. This makes delegates
perfectly suited for "anonymous" invocation. This is a powerful capability.
There are three steps in defining and using delegates: declaration,
instantiation, and invocation. Delegates are declared using delegate
declaration syntax. The example
delegate void SimpleDelegate();
declares a delegate named SimpleDelegate that takes no arguments and returns
no result. 
The example
class Test
{
   static void F() {
      System.Console.WriteLine("Test.F");
   }
   static void Main() {
      SimpleDelegate d = new SimpleDelegate(F);
      d();
   }
}
creates a SimpleDelegate instance and then immediately calls it.


********** 
Keep Smiling, 
Regards. 

Sayad Hashim Ali Kazi
Microsoft India Community Star. 
******************************
SQL Star International Ltd.
SQL House, #13,Infocity,Madhapur,
Hyderabad 500 081.
Tel: +91-40-2310 1650(Off) +91-98661 92794(HP)
http://dotnetjunkies.com/WebLog/SayadHashim/
http://SayadHashim.blogspot.com
http://www.mugh.net
******************************



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to