Repeat String X Times in C#
To repeat string X times in C# we can use the constructor of the string class which can repeat a specific character to a specified number of times inside a string in C#. We can pass the character to be repeated and the number of times it should be repeated to the constructor of the string class in C#.Example
using System;
public class Program
{
public static void Main()
{
string str = new string('k', 3);
Console.WriteLine(str);
}
}
Output
kkk