Best way to repeat a character in C#

What about this:

string tabs = new string('\t', n);

Where n is the number of times you want to repeat the string.

Or better:

static string Tabs(int n)
{
    return new string('\t', n);
}

Leave a Comment