C# linkedlist enumerator chaining.Class linkedListEnumerator : IEnumerator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C# linkedlist enumerator chaining.Class linkedListEnumerator : IEnumerator

Im making HashTable with a dictionary class that Implements IDictionary, Im using a linked list of KeyValuePairs where I have to create an enumerator class to enumerate the hashtable, but I dont know how to implement my enumerator class. It is so far named LinkedListEnumerator : Ienumerator<KeyValuePair<TKey, TValue>> but Im not sure how to do the constructor nor the movenext method or what fields I need Im creating and implementing the new Im trying to use chaining, so the first linked list is not dynamic but the ones holding the keyValuePairs are dictionary class, so not just using the Dictionary hashTable = new Dictionary I dont understand what type current should be in the enumerator class and what the constructor should take in

10th Mar 2022, 5:05 AM
Chioma Chieke
1 Answer
0
I'm gonna be one of those guys but just use the List class with bult in enumerator. If you have to rebuild it from scratch, just look at how List is built.
16th Jan 2023, 4:52 PM
Kail Galestorm
Kail Galestorm - avatar