static void Main(string[] args) { var list = new ConcurrentSortedList(); //var list = new SynchronizedSortedList(); var random = new Random(); var testThreads = Enumerable.Range(0, 2).Select(_ => new Thread(() => { for (int j = 0; j < 10000; ++j) { list.Insert(random.Next()); } })).ToList(); var countingThread = new Thread(() => { try { while (true) { Thread.Sleep(0); Console.WriteLine($"\r{list.Size()}"); Console.Out.FlushAsync(); } } catch (ThreadInterruptedException) { } }); var start = DateTime.Now; testThreads.ForEach(t => t.Start()); countingThread.Start(); testThreads.ForEach(t => t.Join()); countingThread.Interrupt(); Console.WriteLine($"\rElapsed: {DateTime.Now - start}"); Console.WriteLine($"\r{list.Size()}"); if (list.Size() != 20000) { Console.WriteLine("*** Wrong size!"); } if (!list.IsSorted()) { Console.WriteLine("*** Not sorted!"); } }