using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ThreadingExamples { class ThreadSharingClass { class C { public C(int repeat) { mNumRepeat = repeat; } int mNumRepeat; public void run() { for (; mNumRepeat > 0; mNumRepeat--) { Console.Write("x"); } } } public static void Main(string[] args) { C c1 = new C(5); C c2 = new C(5); Thread t1 = new Thread(c1.run); Thread t2 = new Thread(c2.run); t1.Start(); t2.Start(); Console.ReadKey(); // What happens when we change the second Thread initialization to: // Thread t2 = new Thread(c1.run); } } }