public static void SimpleNotInPlaceExample() { var comparer = new UserDefinedClassComparer(); UserDefinedClass[] userArray = new UserDefinedClass[] { new UserDefinedClass(16, 0), new UserDefinedClass(12, 1), new UserDefinedClass(18, 2), new UserDefinedClass(18, 3), new UserDefinedClass(10, 4), new UserDefinedClass(2, 5) }; UserDefinedClass[] sortedUserArray; Console.Write("Unsorted array of user defined class: "); foreach (UserDefinedClass item in userArray) { Console.Write(item); } Console.WriteLine(); sortedUserArray = userArray.OrderBy(element => element.Key).ToArray(); // Serial Linq Sort (C# standard sort, stable) sortedUserArray = userArray.SortRadix(element => element.Key); // Serial Radix Sort (stable) sortedUserArray = Algorithm.SortMerge(userArray, comparer); // Serial Merge Sort (stable) sortedUserArray = userArray.AsParallel().OrderBy(element => element.Key).ToArray(); // Parallel Linq Sort (C# standard sort, stable) sortedUserArray = ParallelAlgorithm.SortMergePar(userArray, comparer); // Parallel Merge Sort sortedUserArray = ParallelAlgorithm.SortMergeStablePar(userArray, comparer); // Parallel Merge Sort (stable) Console.Write("Sorted array of user defined class: "); foreach (UserDefinedClass item in sortedUserArray) { Console.Write(item); } Console.WriteLine(); }