Swaps the elements at the specified positions in the list.
Namespace:
Linq.Extras
Assembly:
Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntaxpublic static void Swap<T>(
this IList<T> list,
int index1,
int index2
)
<ExtensionAttribute>
Public Shared Sub Swap(Of T) (
list As IList(Of T),
index1 As Integer,
index2 As Integer
)
[<ExtensionAttribute>]
static member Swap :
list : IList<'T> *
index1 : int *
index2 : int -> unit
Parameters
- list
- Type: System.Collections.GenericIListT
The list in which to swap elements. - index1
- Type: SystemInt32
The index of the first element to swap. - index2
- Type: SystemInt32
The index of the second element to swap.
Type Parameters
- T
- The type of the elements in list.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IListT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also