.NET Internal : Sorting algorithm used by .NET Framework

Have you ever wonder that which algorithm is being used by .NET Framework for sorting ?

Few days back while learning that how can debug to .NET Framework source code I cam across interesting idea to investigate sorting algorithm used by .NET Framework ? My investigation suggest that framework itself goes through different set of algorithm.

.NET 1.0 - Quick Sort .NET 2.0 - Generic version of Quick Sort .NET 3.0 to 4.0 - No Change .NET 4.5 - Insertion Sort, Heap Sort, Quick Sort, Introsort ( Introspective Sort or Hybrid sort)

As per Microsoft Official Document following things are written for Array.Sort

This method uses the introspective sort (introsort) algorithm as follows: If the partition size is fewer than 16 elements, it uses an insertion sort algorithm. If the number of partitions exceeds 2 * LogN, where N is the range of the input array, it uses a Heapsort algorithm. Otherwise, it uses a Quicksort algorithm.

if you ever look at .NET Framework source code you will find one interesting method.

        [ResourceExposure(ResourceScope.None)]
        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
        private static extern bool TrySZSort(Array keys, Array items, int left, int right)

This method utilize CLR internal implementation for Sort operation.