5 Answers
+ 1
You have to use loops to achieve that
+ 1
Found a solution here: https://stackoverflow.com/questions/411752/best-way-to-repeat-a-character-in-c-sharp
This looked the easiest:
Console.WriteLine(string.Concat(Enumerable.Repeat("a", 22)));
The Console.WriteLine was added by me to test it.
0
Is that the best or only approach?
0
In the c we can call strndup (a, b, n) to duplicate a to b n char, c++ either, i dont know in C#
0
I believe C# has a builtin method to perform string duplication, but if you aren't able to use it, you can define a function to do it using loops.