.NET Framework Repeat


Example

Enumerable.Repeat generates a sequence of a repeated value. In this example it generates "Hello" 4 times.

var repeats = Enumerable.Repeat("Hello", 4);
   
foreach (var item in repeats)
{
    Console.WriteLine(item);
}

/* output:
    Hello
    Hello
    Hello
    Hello
*/