Category Archive for: Delegates and Events

Events

Windows-based applications are message-based, This means that the application is communicating with Windows and Windows is communicating with the application by using predefined messages. These messages are structures that contain various pieces of information that the application and Windows will use to determine what to do next. Prior to libraries such as MFC (Microsoft Foundation Classes) or to development…

Read More →

Covariance and Contra-variance

The method that is invoked by the delegate does not need the exact same types as defined by the delegate declaration. Covariance and contra-variance are possible. Return Type Covariance The return type of a method can derive from the type defined by the delegate, In the example the delegate MyDelegatel is defined to return the type DelegateReturn.…

Read More →

Delegates

Delegates exist for situations in which you want to pass methods around to other methods. To see what that means, consider this line of code: int i = int.Parse{’99’); You are so used to passing data to methods as parameters, as in this example, that you don’t consciously think about it, and for this reason the idea…

Read More →

Delegates and Events

Callback functions are an important part of programming in Windows. If you have a background in C or C++ programming, you have seen callbacks used in many of the Windows APIs. With the addition of the Address Of keyword, Visual Basic developers are now able to take advantage of the API that once was off limits. Callback functions…

Read More →

Back to Top