How to run the program at particular time? It should run
everyday at 3:00 PM. After executing the program should
sleep until next day at 3:00 PM. Please explain with code?
Answer Posted / renu
Here is the code that you expected.
public static void Main()
{
Timer timer = new Timer();
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
timer.Interval = Convert.ToDouble
(ConfigurationManager.AppSettings["TimerInterval"]) * 1000;
timer.Enabled = true;
}
private void OnElapsedTime(object source, ElapsedEventArgs
e)
{
timer.Enabled = false;
//Call your business logic here
timer.Enabled = true;
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
How to use delegates with events?
What is class method c#?
3. Use layered architecture for coding. s.no name description 1 abc xxxxxxxxx 2 abc xxxxxxxxx 3 4 5 6 7 8 Select all Clear all Add Delete Name Description Save close
Explanation on Generic?
What is cosole application?
What do you mean by “finalize” and “finally” methods in c#?
What is serialization in dot net?
What is dto c#?
what are the Disadvantages of vb
What does void mean unity?
Explain how can I get around scope problems in a try/catch?
Explain the difference between the system.array.copyto() and system.array.clone()?
How can i Spawn a Thread
What is int16?
Define an escape sequence, name few strings in escape sequence?