1- /*
1+ /*
22 * COPYRIGHT: See COPYING in the top level directory
33 * PROJECT: ExtendedSystemObjects.Helper
44 * FILE: EntryGenericEnumerator.cs
5- * PURPOSE: Your file purpose here
5+ * PURPOSE: Custom enumerator for my unsage ManagedMap
66 * PROGRAMMER: Peter Geinitz (Wayfarer)
77 */
88
1111
1212namespace ExtendedSystemObjects . Helper
1313{
14- public unsafe struct EntryGenericEnumerator < TValue > : IEnumerator < ( int , TValue ) >
14+ public unsafe struct EntryGenericEnumerator < TValue > : IEnumerator < ( int , TValue ) > where TValue : unmanaged
1515 {
1616 private readonly EntryGeneric < TValue > * _entries ;
1717 private readonly int _capacity ;
1818 private int _index ;
1919
2020 /// <summary>
21- /// Initializes a new instance of the <see cref="EntryGenericEnumerator{TValue}"/> struct.
21+ /// Initializes a new instance of the <see cref="EntryGenericEnumerator{TValue}" /> struct.
2222 /// </summary>
2323 /// <param name="entries">The entries.</param>
2424 /// <param name="capacity">The capacity.</param>
@@ -38,17 +38,22 @@ public bool MoveNext()
3838 while ( ++ _index < _capacity )
3939 {
4040 var entry = _entries [ _index ] ;
41- if ( entry . Used = = SharedResources . Occupied )
41+ if ( entry . Used ! = SharedResources . Occupied )
4242 {
43- Current = ( entry . Key , entry . Value ) ;
44- return true ;
43+ continue ;
4544 }
45+
46+ Current = ( entry . Key , entry . Value ) ;
47+ return true ;
4648 }
4749
4850 return false ;
4951 }
5052
51- public void Reset ( ) => _index = - 1 ;
53+ public void Reset ( )
54+ {
55+ _index = - 1 ;
56+ }
5257
5358 public void Dispose ( ) { }
5459 }
0 commit comments