Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. namespace SmalltalkBooleanExtensionMethods
  3. {
  4.  
  5.     public static class IntExtension
  6.     {
  7.         public delegate Object ClosureWithNoExtraArgs ();
  8.         public delegate void ActionClosureWithNoExtraArgs ();
  9.  
  10.         public static int timesRepeat (this int x, ClosureWithNoExtraArgs method)
  11.         {
  12.             for (int i = x; i > 0; i--) {
  13.                 method.DynamicInvoke ();
  14.             }
  15.             return x;
  16.         }
  17.  
  18.         public static int timesRepeat (this int x, ActionClosureWithNoExtraArgs method)
  19.         {
  20.             for (int i = x; i > 0; i--) {
  21.                 method.DynamicInvoke ();
  22.             }
  23.             return x;
  24.         }
  25.        
  26.     }
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement