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
Explain polymorphism in c# with a simple example?
Tell me the difference between call by value and call by reference.
How to override a function in c#?
What is interface c#?
What are verbatim strings in c#?
What is the meaning of extention?
Explain the different types of delegates used in c#.
What is the difference between protected and private?
How is exception handling implemented in c#?
Explain how do you directly call a native function exported from a dll?
Why we use get and set property in c#?
What is the default value of boolean variable?
How do you implement thread synchronization (object.wait, notify,and criticalsection) in c#?
Define sealed classes in c#?
What is cosole application?