So I have looked at many places and what I am trying to do is not working, although I seem to be doing what everywhere else says I should. I have the following:
private EventHandler statsUpdated;
public event EventHandler StatsUpdated
{
add
{
if (statsUpdated == null || !statsUpdated.GetInvocationList().Contains(value))
{
statsUpdated += value;
}
}
remove
{
statsUpdated -= value;
}
}
protected virtual void OnStatsUpdated(EventArgs e)
{
EventHandler Handler = StatsUpdated;
}
I havent started doing any more to the OnStatsUpdated method yet, as the line in there is erroring saying that StatsUpdated can only be on the left of += or -=. However, I am accessing it from the same class? The above is a direct copy paste, they sit directly together in code right now.
What am I doing wrong?