I have an interface that declares events
interface IMyInterface
{
event SomeHandler MyEvent1;
event SomeHandler MyEvent2;
...
}
but when I enable the Code analysis rule CA1040: Avoid empty interfaces, it complains that my interface violates this rule, any ideas how to solve it?
The reason why it complains, is because this interface does not requires any implamentation.
You cannot implement an event declaration in any specific way.
As Matthew suggest, just suppress it. you might need to add this in the top of you class:
#define CODE_ANALYSIS
or the suppresion is ignored.
Edit
It might be a bug after all, as any classes that inherit the interface is infact requeried to "implement" it - hence : it is not an empty interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With