Times
Repeats an action a number of times.
Source
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"]);
});