Define delegate.- When a function is passed as as parameter, it is known as a delegate - Events such as mouseclick, keypress, ApplicationStart (in ASP.NET), etc., handle some delegate in .NET. - We are aware of these events but VS IDE (Visual Studio Integrated Development Environment) does it for us.
A few keynotes about a Delegate
1. A delegate is declared like a normal Procedure/Method in VB.NET which accepts a parameter but doesn’t return Sub in case of a Sub method and type in case of a Function. 2. Any type of value is not returned. Technically, a Sub delegate returns a Sub pointer but for now, keep in mind, they do not return any value. 3. Delegates only have declaration, they do not have any body. 4. To use a Delegate, you need to attach some function to it. Delegates on their own do not do anything.
|