Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool aborted = false;
- public ResultClass Method()
- {
- for (i = 0; i < int.MaxValue && !aborted; i++)
- {
- // ...
- }
- if (aborted)
- {
- return null;
- }
- return new ResultClass(...);
- }
- public void Abort()
- {
- aborted = true;
- }
- try {
- // abortable code
- }
- finally
- {
- // clean-up resources
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement