private void DoPing(object state) { TraceVM[] localTraces = null; Dispatcher.Invoke(() => localTraces = Traces?.ToArray()); if (localTraces != null) { Parallel.ForEach(localTraces, t => ThreadPool.QueueUserWorkItem(HttpPing, t)); } Dispatcher.Invoke(SaveAll); }