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...
int slotData = randomGenerator.Next(1, 200); int threadId = 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}", threa...