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?
It's a bug. It's fixed in version 10.
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