LINQ Repeat Generation Operator

By Peter Bromberg

The Repeat operator generates a sequence by repeating a value a given number of times. It returns the element as many times as requested as the user enumerates through the result.

var repeated = Enumerable.Repeat("Hello", 5);

Output:
// "Hello", "Hello", "Hello", "Hello", "Hello"

LINQ Repeat Generation Operator  (747 Views)