aronmatthew
Active member
- Joined
- Aug 5, 2019
- Messages
- 43
- Programming Experience
- Beginner
Does anyone have a List Enumerator example for generic list class. One that inherits from IEnumerator. Such that foreach can be used for generic list class.
Collection<T>
and you get that functionality for free. Is there any reason that you can't do that?as is I'm simply using a field List<T>. I am not at all familiar with the Collection class. It should work this way also.There should be no need. If you're defining your own collection class then it should inheritCollection<T>
and you get that functionality for free. Is there any reason that you can't do that?
List<T>
implements IEnumerable<T>
:IEnumerable<T>
:as is I'm simply using a field List<T>.
foreach
loop will already work, so what problem are you actually trying to solve? It's not clear that there is one. What exactly is it that you want to do that you are unable to?