MiniUtilWithIndexT Method

Converts a list to a list with tuples of value and index.

Definition

Namespace: Karamba.Utilities
Assembly: KarambaCommon (in KarambaCommon.dll) Version: 3.0.8.0+eb23a7103f0eca0b6d808121e15fec6899194e15
C#
public static IEnumerable<(T , int Index)> WithIndex<T>(
	this IEnumerable<T> list,
	int start = 0
)

Parameters

list  IEnumerableT
list for which indexes are needed.
start  Int32  (Optional)
start index.

Type Parameters

T
element type of list values.

Return Value

IEnumerableValueTupleT, Int32
tuples of the form (value, index).

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

WithOrdinality() starts per default by 1, whereas WithIndex() starts per default by zero.

See Also