How to use an index variable with C#’s foreach loop?

Amr elshaer
Dec 9, 2021

# Improving existing Code Series

1- By using for loop (Standard way)

2- By using foreach with temp variable and increase value

3- By using the Tuple with Select method in LinQ

improving the code by extracting the extension method to reuse our code.

Resources:-

https://kodify.net/csharp/loop/foreach-index/

--

--

Amr elshaer
Amr elshaer

Written by Amr elshaer

Software engineer | .Net ,C# ,Angular, Javascript

No responses yet