CA1040 code analysis rule: Avoid empty interfaces, complain about non-empty interface

I have an interface that declares events

interface IMyInterface
{
event SomeHandler MyEvent1;
event SomeHandler MyEvent2;
...
}

but when I turn on the CA1040 code analysis rule: avoid empty interfaces, it complains that my interface violates this rule, any ideas how to solve it?

+5
source share
2 answers

The reason he complains is that this interface does not require any kind of imitation. You cannot implement an event declaration in any specific way.

As Matthew thinks, just crush him. you may need to add this to the beginning of your class:

#define CODE_ANALYSIS

or exception is ignored.

Edit

, , , , infact, "" - : .

+2

. . , SuppressMessageAttribute. Visual Studio : http://msdn.microsoft.com/en-us/library/ms182069.aspx

0

All Articles