Advertisement
Guest User

Untitled

a guest
Jun 21st, 2025
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 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.  
  6.     var index = 0;
  7.     foreach (var x in list)
  8.     {
  9.         compute(x, index);
  10.         ++index;
  11.     }
  12. }
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement