Skip to content

Instantly share code, notes, and snippets.

@venj
Created January 27, 2015 12:41
Show Gist options
  • Save venj/5f0a0d5326d2db4c3464 to your computer and use it in GitHub Desktop.
Save venj/5f0a0d5326d2db4c3464 to your computer and use it in GitHub Desktop.
Class extension syntax for C#
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