diff MetroWpf/MetroWpf.Framework/Extensions/IntExtensions.cs @ 15:060f02cd4591

Initial commit, pre airport work
author stevenh7776 stevenhollidge@hotmail.com
date Mon, 12 Mar 2012 23:05:21 +0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf.Framework/Extensions/IntExtensions.cs	Mon Mar 12 23:05:21 2012 +0800
@@ -0,0 +1,40 @@
+using System;
+
+namespace MetroWpf
+{
+    /// <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