Swap<T>( T lhs, T rhs) { T temp; temp = lhs; lhs = rhs; rhs = temp; }
a, b);
SampleClass<T> { Swap( T lhs, T rhs) { } }
GenericList<T> { SampleMethod<T>() { } } GenericList2<T> { SampleMethod<U>() { } }
SwapIfGreater<T>( T lhs, T rhs) T : System.IComparable<T> { T temp; (lhs.CompareTo(rhs) > 0) { temp = lhs; lhs = rhs; rhs = temp; } }
DoWork() { } DoWork<T>() { } DoWork<T, U>() { }