Please i need gelp urgently please | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
- 2

Please i need gelp urgently please

I created my own dictionary class that implements the IDictionary interface which I then Implement everything that IDictionary implements, but I need to create my own enumerator class for that to work, so it can enumerate through the hashlist public class HashDictionary<TKey, TValue> : IDictionary<TKey, TValue> KeyValuePair<TKey, TValue>? First { get; protected set; } LinkedList<KeyValuePair<TKey, TValue>>[]? HashList; HashDictionary() { HashList = new LinkedList<KeyValuePair<TKey, TValue>>[20]; ​LinkedListEnumerator : IEnumerator<KeyValuePair<TKey, TValue>> { KeyvaluePair<TKey, TValue> current; //KeyValuePair<TKey, TValue> First; LinkedListNode<keyValuePair<TKey, TValue>>? Node; O references public object? Current => current; O references KeyvaluePair<TKey, TValue> IEnumerator<KeyValuePair<TKey, TValue>>.Current => current; 1 reference public LinkedListEnumerator(LinkedList<KeyValuePair<TKey, TValue>>[]? list) { Node = current = First; O references public bool MoveNext() { current = current. Next; return cu

10th Mar 2022, 2:21 PM
Chioma Chieke
3 Respuestas
- 1
I created my own dictionary class that implements the IDictionary interface which I then Implement everything that IDictionary implements, but I need to create my own enumerator class for that to work, so it can enumerate through the hashlist public class HashDictionary<TKey, TValue> : IDictionary<TKey, TValue> KeyValuePair<TKey, TValue>? First { get; protected set; } LinkedList<KeyValuePair<TKey, TValue>>[]? HashList; HashDictionary() { HashList = new LinkedList<KeyValuePair<TKey, TValue>>[20]; ​LinkedListEnumerator : IEnumerator<KeyValuePair<TKey, TValue>> { KeyvaluePair<TKey, TValue> current; //KeyValuePair<TKey, TValue> First; LinkedListNode<keyValuePair<TKey, TValue>>? Node; O references public object? Current => current; O references KeyvaluePair<TKey, TValue> IEnumerator<KeyValuePair<TKey, TValue>>.Current => current; 1 reference public LinkedListEnumerator(LinkedList<KeyValuePair<TKey, TValue>>[]? list) { Node = current = First; O references public bool MoveNext() { current = current. Next; return cu
10th Mar 2022, 2:21 PM
Chioma Chieke
- 1
return current != null; O eferences public void Reset() { current = First; O references public void Dispose() { ​
10th Mar 2022, 2:22 PM
Chioma Chieke
- 1
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 LinedListEnumerator : Ienumerator<KeyValuePair<TKey, TValue>> but Im not sure how to do the constructor nor the movenext methos or what fields I need
10th Mar 2022, 2:23 PM
Chioma Chieke