Implementing IEnumerable<> for a custom hash table data structure to be able to use LINQ
Hello guys, I needed to create a hash table from scratch. Now, I want to use that hash table with LINQ. I read that we need to implement the IEnumerable<>. That done, my IDE yell at me to use the follwing methods:
public IEnumerator<V> GetEnumerator() { throw new NotImplementedException(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
public IEnumerator<V> GetEnumerator() { throw new NotImplementedException(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
I believed it's mandatory to implement them since they are part of the interface. My question is, what is theur usage, why do we need them? The implementation given is what my IDE gave me, do I need to add more logic to it?