I working on C#
. I am using time class for making repetitive programs.
// Create a timer with a two second interval.
aTimer = new System.Timers.Timer();
// Hook up the Elapsed event for the timer.
aTimer.Elapsed += OnTimedEvent(iterations, dataItems);
aTimer.Interval = Convert.ToDouble(initial_time)*1000;
aTimer.AutoReset = true;
aTimer.Enabled = true;
private ElapsedEventHandler void OnTimedEvent(Iterations iterations, byte[] dataItems)
{
Console.WriteLine("Scheduling start");
Console.WriteLine("Writing on port");
port.Write(dataItems, 0, dataItems.Length);
msn = (string)iterations.msn;
device_id = (int)iterations.device_id;
p_id = (string)iterations.protocol_id;
}
The error I am getting is
Severity Code Description Project File Line Suppression State Error CS0029 Cannot implicitly convert type 'void' to 'System.Timers.ElapsedEventHandler' CommunicationProfile F:\MDC Development\Scheduler\CommunicationProfile\CommunicationEngine.cs 465 Active
I don't want to return anything from the above method.
Any help would be highly appreciated.