M
Michael C
I'm reading about Iterators and the article I'm reading states that an
enumerator must load all of the objects into memory, which is obviously a
big waste if there are a large number of objects and you only need a few of
them. On the other hand the iterator does not need to load more than 1
object hence uses less memory. But can't you do the same thing with an
enumerator just by returning the next object when Current is called?
If that's the case what's the advantage of an iterator?
Thanks,
Michael
enumerator must load all of the objects into memory, which is obviously a
big waste if there are a large number of objects and you only need a few of
them. On the other hand the iterator does not need to load more than 1
object hence uses less memory. But can't you do the same thing with an
enumerator just by returning the next object when Current is called?
If that's the case what's the advantage of an iterator?
Thanks,
Michael