Limited options for accessing events in derived classes?

Posted by maxp on Stack Overflow See other posts from Stack Overflow or by maxp
Published on 2010-04-22T10:10:15Z Indexed on 2010/04/22 10:13 UTC
Read the original article Hit count: 310

Filed under:
|
|

Im refactoring a class, and moving sections into a base class.

I have a few events similar to

public event EventHandler GridBinding;

Which are now in the base class, but i am finding i cannot now check to see if the event is null in my derived class. Doing so gives me the error:

The event 'xyz.GridBinding' can only appear on the left hand side of += or -= (except when used from within the type 'xyz._MyBaseClass').

Is this correct, am i missing anything, or is there any way to get around this or is writing an accessor the only way to do this? I am using c#/.net 4.0

© Stack Overflow or respective owner

Related posts about events

Related posts about derived-class