Say I have a class that implements IEnumerable<T>. It currently uses the yield keyword in the GetEnumerator() method. But now I need to do a bit more, for example I would like to clean up after myself. To do this, unless I have overlooked anything, I need to implement the IEnumerator<T> interface. But where would you say I should do that?
Should the class itself implement it and GetEnumerator() return this? Or would it be better to hide it in a private class? Or should it maybe just be an entirely different class? What are some common practices to this?