Here is my current swap code for swapping 2 KeyValuePair objects in an array:
KeyValuePair<int, T> t = a[i];
a[i] = a[j];
a[j] = t;
Would there be any speed advantage to using unsafe code and merely swapping the pointers of the 2 objects? Or does the complier effectively boil this safe code down to effectively doing just that?