Swap
Swaps two variables/objects with each other
Source
<Extension()>
Sub Swap(Of T)(ByRef object1 As T, ByRef object2 As T)
If object2 Is Nothing Then
object1 = Nothing
Else
Dim originalObject1 = object1
object1 = object2
object2 = originalObject1
End If
End Sub
Example
string1.Swap(string2) 'Swaps string1 with string2
myObj.Swap(Nothing) 'Sets myObj to Nothing
listbox1.Swap(listbox2) 'Swaps two Listboxes with each other