I'm trying to get around dual inheritance in C# by re-implementing one of the parent classes as an interface with extension methods.
The problem I'm encountering is that
event EventHandler<EventArgs> Disconnecting;
public static void OnDisconnected(this AutoConnectClientBase target)
{
target.ClientConnectionState = ConnectionState.Disconnected;
target.Disconnected(target, EventArgs.Empty);
}
Can't be called in the extension methods.
I get: *.Disconnecting can only appear on the left hand side of += or -=
While this makes perfect sense, in this case I wish it were not so.
What I'm looking for is a workaround that will permit me to access my interface's EventHandlers in the extension code. I'd like to keep it as simple as possible since the class I'm making into an interface is accessed by a large number of classes already and this is a change I'm reluctantly making in the first place.