Advertisement
Guest User

Untitled

a guest
Jun 21st, 2025
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. public static void ForEachWithIndex<TKey>(this IEnumerable<TKey> list, Action<TKey, int> compute)
  2.     {
  3.         if (list == null)
  4.             return;
  5.         var rlist = list.ToList();
  6.         int count = rlist.Count;
  7.         for (int i = 0; i < count; i++)
  8.         {
  9.             compute(rlist[i], i);
  10.         }
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement