Mercurial > silverbladetech
view Chronosv2/source/Extensions/IntExtensions.cs @ 12:6a0449185449
SCC changed from TFS to HG
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Tue, 21 Feb 2012 17:47:35 +0700 |
parents | 443821e55f06 |
children |
line wrap: on
line source
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 } }