comparison Chronosv2/source/Extensions/IntExtensions.cs @ 10:443821e55f06

Initial cleaned up add from Codeplex files
author stevenh7776 stevenhollidge@hotmail.com
date Tue, 21 Feb 2012 17:25:44 +0700
parents
children
comparison
equal deleted inserted replaced
9:904a9faadf8b 10:443821e55f06
1 using System;
2
3 namespace Chronos.Extensions
4 {
5 /// <summary>
6 /// Extension methods for the string data type
7 /// </summary>
8 public static class IntExtensions
9 {
10 #region · Extensions ·
11
12 /// <summary>
13 /// Performs the specified action n times based on the underlying int value.
14 /// </summary>
15 /// <param name="value">The value.</param>
16 /// <param name="action">The action.</param>
17 public static void Times(this int value, Action action)
18 {
19 for (var i = 0; i < value; i++)
20 {
21 action();
22 }
23 }
24
25 /// <summary>
26 /// Performs the specified action n times based on the underlying int value.
27 /// </summary>
28 /// <param name="value">The value.</param>
29 /// <param name="action">The action.</param>
30 public static void Times(this int value, Action<int> action)
31 {
32 for (var i = 0; i < value; i++)
33 {
34 action(i);
35 }
36 }
37
38 #endregion
39 }
40 }