|
12 | 12 |
|
13 | 13 | namespace ExtendedSystemObjects.Helper |
14 | 14 | { |
| 15 | + /// <summary> |
| 16 | + /// Enumerator Helper |
| 17 | + /// </summary> |
| 18 | + /// <typeparam name="T">Generic Type, must be unmanaged</typeparam> |
| 19 | + /// <seealso cref="System.Collections.Generic.IEnumerator<T>" /> |
15 | 20 | internal unsafe struct Enumerator<T> : IEnumerator<T> where T : unmanaged |
16 | 21 | { |
| 22 | + /// <summary> |
| 23 | + /// The data |
| 24 | + /// </summary> |
17 | 25 | private readonly T* _data; |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// The length |
| 29 | + /// </summary> |
18 | 30 | private readonly int _length; |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// The index |
| 34 | + /// </summary> |
19 | 35 | private int _index; |
20 | 36 |
|
| 37 | + /// <summary> |
| 38 | + /// Initializes a new instance of the <see cref="Enumerator{T}"/> struct. |
| 39 | + /// </summary> |
| 40 | + /// <param name="data">The data.</param> |
| 41 | + /// <param name="length">The length.</param> |
21 | 42 | public Enumerator(T* data, int length) |
22 | 43 | { |
23 | 44 | _data = data; |
24 | 45 | _length = length; |
25 | 46 | _index = -1; |
26 | 47 | } |
27 | 48 |
|
| 49 | + /// <summary> |
| 50 | + /// Gets the current. |
| 51 | + /// </summary> |
| 52 | + /// <value> |
| 53 | + /// The current. |
| 54 | + /// </value> |
28 | 55 | public T Current |
29 | 56 | { |
30 | 57 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
31 | 58 | get => _data[_index]; |
32 | 59 | } |
33 | 60 |
|
| 61 | + /// <summary> |
| 62 | + /// Gets the current. |
| 63 | + /// </summary> |
| 64 | + /// <value> |
| 65 | + /// The current. |
| 66 | + /// </value> |
34 | 67 | object IEnumerator.Current => Current; |
35 | 68 |
|
| 69 | + /// <summary> |
| 70 | + /// Advances the enumerator to the next element of the collection. |
| 71 | + /// </summary> |
| 72 | + /// <returns> |
| 73 | + /// <see langword="true" /> if the enumerator was successfully advanced to the next element; <see langword="false" /> if the enumerator has passed the end of the collection. |
| 74 | + /// </returns> |
36 | 75 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
37 | 76 | public bool MoveNext() => ++_index < _length; |
38 | 77 |
|
| 78 | + /// <summary> |
| 79 | + /// Sets the enumerator to its initial position, which is before the first element in the collection. |
| 80 | + /// </summary> |
39 | 81 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
40 | 82 | public void Reset() => _index = -1; |
41 | 83 |
|
42 | | - public void Dispose() { /* no resources to clean */ } |
| 84 | + /// <summary> |
| 85 | + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| 86 | + /// </summary> |
| 87 | + public readonly void Dispose() { /* no resources to clean */ } |
43 | 88 | } |
44 | 89 | } |
0 commit comments