Повторить символы в cтроке

Есть символ. Любой. Например: $ Как можно повторить его в строке определенное количество раз или исходя из определенных условий задачи? Например, сделать строку из символов больше количество букв слова на два символа:

стол $$$$$$


Ответы (3 шт):

Автор решения: MBo
String s1 = "qwer";
String s2 = new String('$', 2 + s1.Length); 
Console.WriteLine(s2);

s1 += new String('$', 6 - s1.Length);
Console.WriteLine(s1);
→ Ссылка
Автор решения: Casper
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            const int VALUE = 2;
            string[] results =
            {
                Repeat('$', "тестируем".Length, VALUE),
                Repeat('-', "на".Length, VALUE),
                Repeat('=', "нескольких".Length, VALUE),
                Repeat('*', "словах".Length, VALUE)
            };

            foreach (string result in results)
            {
                Console.WriteLine(result);
            }
        }

        private static string Repeat(char ch, int count, int summand)
        {
            return new string(ch, count + summand);
        }
    }
}
→ Ссылка
Автор решения: A K

Мне предыдущие ответы нравятся, я просто для коллекции оставлю linq-версию:

private static string Repeater(string source, char placeholder, int additional)
{
    return new string(Enumerable.Repeat(placeholder, source.Length + additional).ToArray());
}

Интересно кстати, что будет лучше преобразовывать в строку new string или string.Concat (нет под рукой студии):

private static string Repeater(string source, char placeholder, int additional)
{
    return string.Concat(Enumerable.Repeat(placeholder, source.Length + additional));
}

Ну и вот ещё linq-вариант, на других функциях:

private static string Repeater(string source, char placeholder, int additional)
{
    var a = source.Select(x => placeholder);
    var b = Enumerable.Repeat(placeholder, additional);
    return new string(a.Concat(b).ToArray());
}

(не стал в однострочник соединять для наглядности)

Ну и ещё один в голову пришёл:

private static string Repeater(string source, char placeholder, int additional)
{
    return Enumerable.Repeat(placeholder, source.Length + additional)
                     .Aggregate(new StringBuilder(), (seed, c) => seed.Append(c))
                     .ToString();
}
→ Ссылка