MiniUtilWithIndexT Method
Converts a list to a list with tuples of value and index.
Namespace: Karamba.UtilitiesAssembly: KarambaCommon (in KarambaCommon.dll) Version: 3.0.8.0+eb23a7103f0eca0b6d808121e15fec6899194e15
public static IEnumerable<(T , int Index)> WithIndex<T>(
this IEnumerable<T> list,
int start = 0
)
<ExtensionAttribute>
Public Shared Function WithIndex(Of T) (
list As IEnumerable(Of T),
Optional start As Integer = 0
) As IEnumerable(Of ( As T, Index As Integer))
public:
[ExtensionAttribute]
generic<typename T>
static IEnumerable<ValueTuple<T, int>>^ WithIndex(
IEnumerable<T>^ list,
int start = 0
)
[<ExtensionAttribute>]
static member WithIndex :
list : IEnumerable<'T> *
?start : int
(* Defaults:
let _start = defaultArg start 0
*)
-> IEnumerable<ValueTuple<'T, int>>
- list IEnumerableT
- list for which indexes are needed.
- start Int32 (Optional)
- start index.
- T
- element type of list values.
IEnumerableValueTupleT,
Int32tuples of the form (value, index).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).
WithOrdinality() starts per default by 1, whereas
WithIndex() starts per default by zero.