How to repeat a string N number of times in C# ?

Do you want to repeat a string N number of times in C# ? . You can use the string.concat and Enumerable.Repeat to achieve it in .NET Framework 4.0 and higher.

How to repeat a string N number of times in C# ?

using System;
using System.Linq;

namespace ACCode
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = 4; 
            var result = string.Concat(Enumerable.Repeat("Abundantcode", X));
            Console.WriteLine(result);
            Console.ReadLine();
        }
       

    } 
}
%d