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;
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 void Dispose()
36 {
37 this.e.Dispose();
38 }
39
43 public bool MoveNext()
44 {
45 return this.MoveNextAsync().Result;
46 }
47
54 public async Task<bool> MoveNextAsync()
55 {
56 while (await this.e.MoveNextAsync())
57 {
58 if (this.offset > 0)
59 this.offset--;
60 else
61 return true;
62 }
63
64 return false;
65 }
66
70 public void Reset()
71 {
72 this.offset = this.offset0;
73 this.e.Reset();
74 }
75 }
76}
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.