private void TestAndCompare <T>(T[] numbers) where T : IComparable <T> { var sorted = from n in numbers orderby n select n; var sl = new CoCoL.SortedList <T, T>(); foreach (var n in numbers) { sl.Add(n, n); } var cmp = sl.Zip(sorted, (a, b) => new { SL = a, Real = b }); foreach (var x in cmp) { if (x.Real.CompareTo(x.SL.Key) != 0 || x.Real.CompareTo(x.SL.Value) != 0) { foreach (var y in cmp) { Console.WriteLine("{0}: ({1}, {2})", y.Real, y.SL.Key, y.SL.Value); } throw new Exception("Sorted sequence was incorrect!"); } } }