C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,011 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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. It would take at least 10 seconds. I want to stop that method in the middle at any time. I know that I can use a flag like shouldStop. But if I prefer to use that, I would have to use it after every statement, which does not seem to be a proper solution.
Any help is greatly appreciated.