Performance implications of unmanaged array accesses

I was recently shown the following code and asked why the loop calling SafeAccess executed significantly faster than the second loop calling UnsafeAccess:          static int [] intarray = new int [5000];               static void SafeAccess(int a, int b)        {            int temp = intarray[a];            intarray[a] = intarray[b];            intarray[b] =…