Hooked on LINQ

Hooked on LINQ - Developers' Wiki
for .NET Language Integrated Query

Quick Search

Advanced Search »
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

If you would like to comment on this page, click on the Discuss button located on the top-right of each page. Feel free to edit any mistakes or omissions you find. If you have an objection or find in-appropriate content then contact the administrator. This website is not affiliated with Microsoft®, all content and opinions are those of the specific author and some advice, solutions and article may contain unintentional errors - please use care. Powered by ScrewTurn Wiki version 2.0.33. Some of the icons created by FamFamFam.