Sunday, July 22, 2007

Delegate : Keyword: Basics

• Syntax: public delegate void TestDelegate(String message);
• Used to declare a reference type that can be used to encapsulate named or an anonymous method
• Delegates are similar to function pointers but are type safe and thread secure
• Delegates are the basis for Events
• For use with named methods, a delegate must be instantiated with a method that has an acceptable signature
• For use with anoymous methods, the delegate and the code to be associated with it are declared together

No comments: