Times

public static void Times(this int repeatCount, Action<int> action) {
  for (int i = 1; i <= repeatCount; i++) {
    action(i);
  }
}
Example:
DataTable table = GetSomeTable();
var noOfRows = table.Rows.Count;
noOfRows.Times(rowNo => {
  var row = table.Rows[rowNo];
  Console.WriteLine("rowNo:{0}, Name:{1}", rowNo, row["Name"]);
});

Description

Repeats an action a number of times.

Details

Double click on the code to select all.

 

;