Repeat Operator

Back to Standard Query Operators.

Edit

Introduction

The Repeat operator generates a sequence by repeating a value a given number of times.

Edit

Method Signatures

public static IEnumerable<TResult> Repeat<TResult>(
    TResult element, 
    int count)



Edit

Exceptions

Throws an ArgumentOutOfRangeException if count < 0.


Edit

Pseudo-code

If count < 0 throw an ArgumentOutOfRangeException.
Loop count times.
Return element. Resume execution from this point when the next element is requested.

Edit

Loop Count

This is a generation type operator, it does not loop through a given collection. It returns the element as many times as requested as the user enumerates through the result.


Edit

Code Samples

TODO: Needs code sample