Friday, January 17, 2014

Extension to mimic the old VB string function

  public static class BlahExtension
    {
       public static char[]  Space(this int cnt, char c = ' ' )
       {
           return Enumerable.Repeat(c,cnt).ToArray();  
       }
    }

or this:

 public static string Space(this int cnt, char c = ' ')
       {
            return new string(Enumerable.Repeat('f', 10).ToArray());
       }

No comments:

Post a Comment