This is a stone-age syntax. Use:
doubleClickTimer.Tick += (sender, eventArgs) => {
}
Even if you are using C# v.2 where lambda syntax was not available, anonymous methods were already available:
doubleClickTimer.Tick += delegate(object sender, System.EventArgs eventArgs) {
}
As to the versions of C# prior to v.2, I think I can safely assume that they should not be used anymore.
Now, do you know there are two more timers, not as bad as the class
System.Windows.Forms
, shamelessly inaccurate, designed only for ease of use? Two other, much better classes are:
System.Threading.Timer
:
http://msdn.microsoft.com/en-us/library/system.threading.timer.aspx[
^],
System.Timers.Timer
:
http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx[
^].
Finally, I have no idea why are you using a timer, but you should be warned that the timers are often misused. In most situations, the better, more reliable and easier to develop and maintain solution is using threads instead.
—SA