Use constructor
string output = new string('a', input.Length);
If you want to repeat the real string n times, you can use Enumerable.Repeat :
string output = string.Join("", Enumerable.Repeat(rep, input.Length));
I use String.Join to concatenate each line with the specified delimiter (in this case, no).
source share