Contra Variance

Contra variance works the opposite of covariance: From a derived class, you can take advantage of an abstract class or of a base class. To understand how contra variance works, the best example is to create a client application in which two events of the same control are handled by the same event handler. For this, create a new Windows Presentation Foundation application and write the following XAML code to define a simple Button control:

<Button Content="Button" Height="50" Name="Button1" Width="150" />

Creating WPF Applications

If you are not familiar with WPF applications, you notice one important thing when creating such projects: The designer provides a graphical editor and the code editor for ...

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.