static void Work(Canceler c) { while (true) { c.ThrowIfCancellationRequested(); // ... try { OtherMethod(c); } finally { /* any required cleanup */ } } }
static void OtherMethod(Canceler c) { // Do some thing... c.ThrowIfCancellationRequested(); }