diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/IntExtensions.cs	Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,40 @@
+using System;
+
+namespace Chronos.Extensions
+{
+    /// <summary>
+    /// Extension methods for the string data type
+    /// </summary>
+    public static class IntExtensions
+    {
+        #region · Extensions ·
+
+        /// <summary>
+        /// Performs the specified action n times based on the underlying int value.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="action">The action.</param>
+        public static void Times(this int value, Action action)
+        {
+            for (var i = 0; i < value; i++)
+            {
+                action();
+            }
+        }
+
+        /// <summary>
+        /// Performs the specified action n times based on the underlying int value.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="action">The action.</param>
+        public static void Times(this int value, Action<int> action)
+        {
+            for (var i = 0; i < value; i++)
+            {
+                action(i);
+            }
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file