Declaring Delegates
A delegate is defined via the Delegate
keyword followed by the method signature it needs to implement. Such a signature can be referred to as a Sub
or as a Function
and may or may not receive arguments. The following code defines a delegate that can handle reference to methods able to check an email address, providing the same signature of the delegate:
Notice that IsValidMailAddress
is a type and not a method as the syntax might imply. emailAddress
is a variable containing the email address ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.