Hello,
I want to exit a loop after specific time. Can anyone let me know how i can achieve this.
I want to do something like below:
do
{
// Third party call to check for specific condition
}
While(condition);
Info("It is taking longer than expected. Please try again");
if condition evaluates to false, it will stop. Setting condition to false will stop the loop.
Yes.. but i also want to exit the loop based on specific time..there are 2 cases.
1) condition becomes false or
2) 30 seconds
After 30 seconds if condition is still true then also i want to exit.
You could use the System.Diagnostics.Stopwatch class to measure the elapsed time and set the condition to stop. I have not tested this so it might not work but I expect it should.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,122
André Arnaud de Cal... 918 Super User 2025 Season 2
Sohaib Cheema 646 User Group Leader