Using C#, how can I convert/iterate a List/Array/Dictionary to a collection which can easily output it's index?
E.g. in Scala I'd use .zipWithIndex in order to convert a list of [a,b,c] to a list of [(a, 0), (b, 1), (c, 2)]
Is there an 'easy' way of doing this with inbuilt .net methods? Via LINQ or otherwise?
Or do I have to use an external functional library, or code my own extension method?
From their docs:
http://www.scala-lang.org/api/2.12.1/scala/collection/immutable/List.html#zipWithIndex:List[(A,Int)]
Example: List("a", "b", "c").zipWithIndex = List(("a", 0), ("b", 1), ("c", 2))