static void Main() { var t = new System.Threading.ThreadLocal <int>(true); System.Threading.Tasks.Parallel.For(0, 100000, n => { t.Value += 1; }); System.Console.WriteLine(t.Values.Sum()); }
/// <summary>Constructs a new debugger view object for the provided ThreadLocal object.</summary> /// <param name="tlocal">A ThreadLocal object to browse in the debugger.</param> public SystemThreading_ThreadLocalDebugView(ThreadLocal <T> tlocal) { m_tlocal = tlocal; }