You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MouseEventArgs and KeyEventArgs are not base types of EventArgs #14062
This page says: "This example demonstrates how delegates can be used with methods that have parameters of a type that are base types of the delegate signature parameter type"
But neither MouseEventArgs or KeyEventArgs are base types of EventArgs, but the opposite is true.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: f38da104-ca1b-7cc2-15d6-f6486c818e60
Version Independent ID: 98d90b16-a4d0-d532-9fea-c51f6e262288
So it's saying that EventArgs is the base type of KeyEventArgs and MouseEventArgs, which is correct.
Maybe the use of plural and singular is confusing? The text talks about "methods" and "delegate signature", but the example has a single method and multiple delegate signatures.
Thanks for submitting your feedback, @keni1. As @svick points out, the documentation is correct. But as he also points out, this page is confusing, and the contravariance example requires very careful reading (and re-reading) before it becomes clear. I've opened #14072 to attempt to add clarity to the description.
Activity
svick commentedon Aug 28, 2019
I think the page is correct: in the example, the method in question is:
And the delegate signatures are:
So it's saying that
EventArgsis the base type ofKeyEventArgsandMouseEventArgs, which is correct.Maybe the use of plural and singular is confusing? The text talks about "methods" and "delegate signature", but the example has a single method and multiple delegate signatures.
rpetrusha commentedon Aug 28, 2019
Thanks for submitting your feedback, @keni1. As @svick points out, the documentation is correct. But as he also points out, this page is confusing, and the contravariance example requires very careful reading (and re-reading) before it becomes clear. I've opened #14072 to attempt to add clarity to the description.