using System; public class C { public C(){} ~C(){} public void getData(){} } public class B { private bool _flag; private C _c; public B(C c) { _flag=true; _c=c; (new System.Threading.Thread(delegate() { run(); })).Start(); } ~B(){_flag=false;} public void run(){ while (_flag){_c.getData();};} } public class A: C { B _b; public A(){_b=new B(this); } ~A(){} } public class Test { public static void Main() { { A a=new A(); } Console.Write("hello"); // your code goes here } }