static void Work(RulyCanceler c) { while (true) { c.ThrowIfCancellationRequested(); // ... try { OtherMethod(c); } finally { /* any required cleanup */ } } }
static void OtherMethod(RulyCanceler c) { Console.WriteLine("Other Method Called"); c.ThrowIfCancellationRequested(); }