Hooked on LINQ

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

Quick Search

Advanced Search »
{TOC}
Namespace:System.Linq
Assembly:System.Core.dll
Extends:IEnumerable<T>

Back to Standard Query Operator Index


Edit

Introduction

The Skip operator skips a given number of elements from a sequence and then yields the remainder of the sequence.

Edit

Method Signatures

public static IEnumerable<TSource> Skip<TSource>(
    this IEnumerable<TSource> source, 
    int count)



Edit

Exceptions

Throw an ArgumentNullException if source is null.


Edit

Pseudo-code

If source is null, throw an ArgumentNullException.
Iterate the source sequence.
If count > 0, decrement count by one.
If count <= 0.
Resume iterating source from the point we skipped to.
Return the current element. Resume execution from this point when the next element is requested.

Note: If count < 0, all records are returned.
Note: If count is greater than the number of elements in source, then no elements are returned.


Edit

Loop Count

Initially, count number of records are enumerated over with no result returned. This operator implements the standard deferred execution iterator pattern. This means, no looping will occur until the result is iterated over.

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.