Skip to content

Commit 39ab94c

Browse files
author
LoneWandererProductions
committed
add the last remaining unfinished comments
1 parent 66e6480 commit 39ab94c

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

ExtendedSystemObjects/Helper/Enumerator.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,78 @@
1212

1313
namespace ExtendedSystemObjects.Helper
1414
{
15+
/// <summary>
16+
/// Enumerator Helper
17+
/// </summary>
18+
/// <typeparam name="T">Generic Type, must be unmanaged</typeparam>
19+
/// <seealso cref="System.Collections.Generic.IEnumerator&lt;T&gt;" />
1520
internal unsafe struct Enumerator<T> : IEnumerator<T> where T : unmanaged
1621
{
22+
/// <summary>
23+
/// The data
24+
/// </summary>
1725
private readonly T* _data;
26+
27+
/// <summary>
28+
/// The length
29+
/// </summary>
1830
private readonly int _length;
31+
32+
/// <summary>
33+
/// The index
34+
/// </summary>
1935
private int _index;
2036

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>
2142
public Enumerator(T* data, int length)
2243
{
2344
_data = data;
2445
_length = length;
2546
_index = -1;
2647
}
2748

49+
/// <summary>
50+
/// Gets the current.
51+
/// </summary>
52+
/// <value>
53+
/// The current.
54+
/// </value>
2855
public T Current
2956
{
3057
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3158
get => _data[_index];
3259
}
3360

61+
/// <summary>
62+
/// Gets the current.
63+
/// </summary>
64+
/// <value>
65+
/// The current.
66+
/// </value>
3467
object IEnumerator.Current => Current;
3568

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>
3675
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3776
public bool MoveNext() => ++_index < _length;
3877

78+
/// <summary>
79+
/// Sets the enumerator to its initial position, which is before the first element in the collection.
80+
/// </summary>
3981
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4082
public void Reset() => _index = -1;
4183

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 */ }
4388
}
4489
}

ExtendedSystemObjects/UnmanagedArray.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ public void RemoveAt(int index)
134134
/// <returns>
135135
/// An enumerator that can be used to iterate through the collection.
136136
/// </returns>
137-
public IEnumerator<int> GetEnumerator()
137+
public IEnumerator<T> GetEnumerator()
138138
{
139-
return new Enumerator<int>(_ptr, Length);
139+
return new Enumerator<T>(_ptr, Length);
140140
}
141141

142142
/// <summary>

0 commit comments

Comments
 (0)