Reputation: 4318
In an UWP application I have a class like this:
public class MyClass
{
public event TypedEventHandler<MyClass, EventArgs> MyEvent;
}
When I run code analysis this code gives me two warnings:
CA1009 Declare the second parameter of 'TypedEventHandler' as an EventArgs, or an instance of a type that extends EventArgs, named 'e'.
CA1009 Declare the first parameter of 'TypedEventHandler' as an object named 'sender'.
How do I solve these issues? I've read the documentation about CA1009 but it doesn't give me any hint.
Upvotes: 0
Views: 476
Reputation: 12019
For the classic .NET pattern, your class should derive from EventArgs
to fix the first warning, although that won't work for a Windows Runtime component. You should just ignore the warning.
For the classic .NET pattern, the first type should be Object
but for newer designs (like WinRT) you should also ignore the second warning.
Upvotes: 1