.Net ramblings
# Tuesday, 10 October 2006
A generic Swap function
if i ever forget how to write this function then... well, let's hope i never do.  i was really surprised not to be able to find it in the SDK.  i'm posting it here for reference anyway.  note: this can only be used in .Net 2.0 which supports generics.
/// <summary>
/// Swap 2 objects
/// </summary>
public static void Swap<T>(ref T first, ref T second)
T tmp = first;
first = second;
second = tmp;

Tuesday, 10 October 2006 16:55:31 (GMT Daylight Time, UTC+01:00)  #    Comments [3]  .Net General