localSlot = Thread.AllocateDataSlot(); }publicstaticvoidSlotTest(){// Set different data in each thread's data slot.Thread.SetData(localSlot, randomGenerator.Next(1,200));// Write the data from each thread's data slot.Console.WriteLine("Data in thread_{0}'s data slot: {1,3}", AppD...
(1,200);intthreadId = Thread.CurrentThread.ManagedThreadId; Thread.SetData( Thread.GetNamedDataSlot("Random"), slotData);// Show what was saved in the thread's data slot.Console.WriteLine("Data stored in thread_{0}'s data slot: {1,3}", threadId, slotData);// Allow other threads ...
Thread.GetNamedDataSlot("Random"), slotData);// Show what was saved in the thread's data slot.Console.WriteLine("Data stored in thread_{0}'s data slot: {1,3}", threadId, slotData);// Allow other threads time to execute SetData to show// that a thread's data slot is unique to...