Relaxed Delegates

When you code methods that are pointed to by delegates, your methods must respect the delegate’s signature. An exception to this rule is when your method has parameters that are not used and therefore can be omitted. Such a feature is known as relaxed delegates. The simplest example to help you understand relaxed delegates is to create a WPF application. After you’ve created your application, drag a Button control from the toolbox onto the main window’s surface. Double-click the new button to activate the code editor so that Visual Studio generates an event handler stub for you and type the following code:

Private Sub Button1_Click(ByVal sender As Object,                               ByVal e As ...

Get Visual Basic 2015 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.