Created
January 27, 2015 12:41
-
-
Save venj/5f0a0d5326d2db4c3464 to your computer and use it in GitHub Desktop.
Class extension syntax for C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System | |
{ | |
public static class StringExtension | |
{ | |
public static string TimesMe(this String str, int times) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
for (int i = 0; i < times; i++) | |
{ | |
sb.Append(str); | |
} | |
return sb.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment