Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OffsetEnumerator.cs
1using System;
2using System.Collections;
3using System.Threading.Tasks;
4
6{
11 {
12 private readonly IResultSetEnumerator e;
13 private readonly int offset0;
14 private int offset;
15
21 public OffsetEnumerator(IResultSetEnumerator ItemEnumerator, int Offset)
22 {
23 this.e = ItemEnumerator;
24 this.offset = this.offset0 = Offset;
25 }
26
30 public object Current => this.e.Current;
31
35 public bool MoveNext()
36 {
37 return this.MoveNextAsync().Result;
38 }
39
46 public async Task<bool> MoveNextAsync()
47 {
48 while (await this.e.MoveNextAsync())
49 {
50 if (this.offset > 0)
51 this.offset--;
52 else
53 return true;
54 }
55
56 return false;
57 }
58
62 public void Reset()
63 {
64 this.offset = this.offset0;
65 this.e.Reset();
66 }
67 }
68}
Enumerator that skips a given number of result records.
async Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
OffsetEnumerator(IResultSetEnumerator ItemEnumerator, int Offset)
Enumerator that skips a given number of result records.