MoreEnumerableMoveT Method

Returns a sequence with a range of elements in the source sequence moved to a new offset.

Definition

Namespace: MoreLinq
Assembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
C#
public static IEnumerable<T> Move<T>(
	this IEnumerable<T> source,
	int fromIndex,
	int count,
	int toIndex
)

Parameters

source  IEnumerableT
The source sequence.
fromIndex  Int32
The zero-based index identifying the first element in the range of elements to move.
count  Int32
The count of items to move.
toIndex  Int32
The index where the specified range will be moved.

Type Parameters

T
Type of the source sequence.

Return Value

IEnumerableT
A sequence with the specified range moved to the new position.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. 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).

Remarks

This operator uses deferred execution and streams its results.

Example

C#
var result = Enumerable.Range(0, 6).Move(3, 2, 0);
The result variable will contain { 3, 4, 0, 1, 2, 5 }.

See Also