How to stop a function in middle in C#?

  • Thread starter Thread starter Bhadurudeen
  • Start date Start date
B

Bhadurudeen

Guest
It may be a basic question, But I could not find an answer for that.

I have a function having some sync and async statements. That would take at least 10 seconds to complete. I want to stop that method in the middle at anytime. I know that I can use a flag like shouldStop = true;. But if I prefer to use that, I would have to use it after every statement of that function, which does not seem to be a proper solution.

Any help is greatly appreciated. (It is an uwp C# app for windows 10 store.)

Continue reading...
 
Back
Top