I’ve found out that inside the Array.Sort,
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail), SecurityCritical]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool TrySZSort(Array keys, Array items, int left, int right);
gets called.
Any ideas how this is implemented?
That method is implemented in native code, internal within the CLR itself. There are many methods like this on the very core, low level types. For example, quite a few of the methods on
System.Stringare flagged InternalCall and implemented in the common language runtime itself.