I\'m learning about Events / Delegates in C#. Could I ask your opinion on the naming/coding style I\'ve chosen (taken from the Head First C# book)?
Am teaching a fr
Looks good, aside from the fact that OnTick
doesn't follow the typical event invocation model. Typically, On[EventName]
raises the event a single time, like
protected virtual void OnTick(EventArgs e)
{
if(Tick != null) Tick(this, e);
}
Consider creating this method, and renaming your existing "OnTick
" method to "StartTick
", and instead of invoking Tick
directly from StartTick
, call OnTick(EventArgs.Empty)
from the StartTick
method.