6

According to the C# specification this is valid code, and it compiles and runs.

var myObj = new MyClass();
var x = nameof(myObj.SomeEvent);
Console.Write(x); // Prints 'SomeEvent'

where SomeEvent is:

public event EventHandler SomeEvent;    

But ReSharper produces the warning:

"The event SomeEvent can only appear on the lefthand side of += or -="

I can't find a way to suppress this in Options > Inspection Severity. Is it a bug in ReSharper?

Rob Kent
  • 5,183
  • 4
  • 33
  • 54

1 Answers1

3

It's a bug. It's fixed in version 10.

Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88