Click or drag to resize

RankedMapTKey, TValueSkip Method

Bypasses a supplied number of elements and yields the remaining elements.

Namespace:  Kaos.Collections
Assembly:  KaosCollections (in KaosCollections.dll) Version: 4.2.0.0
Syntax
C#
public RankedMapTKey, TValueEnumerator Skip(
	int count
)

Parameters

count
Type: SystemInt32
Number of elements to skip.

Return Value

Type: RankedMapTKey, TValueEnumerator
The elements after the supplied index.
Exceptions
ExceptionCondition
InvalidOperationExceptionWhen the map was modified after the enumerator was created.
Remarks
This is a O(log n) operation.
Examples
In the below snippet, both Skip operations perform an order of magnitude faster than their LINQ equivalent.
C#
var map = new RankedMap<int,int>() { {295,-295} };
for (int i = 2; i < 500; i += 2) map.Add (i,-i);

foreach (var x in map.Skip (100).SkipWhile (kv => kv.Key%2==0).Skip (100))
    Console.Write ($"{x} ");

// Output: [494, -494] [496, -496] [498, -498]
See Also