Coding For a Living


A place to share and comment about coding for a living.

Visual Basic 2012–Iterators Mike McIntyre

Iterators are used to perform custom iteration over collections such as lists or arrays.

Iterators make it possible to use the iterator programming pattern. Wikipedia states: “In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements. The iterator pattern decouples algorithms from containers; in some cases, algorithms are necessarily container-specific and thus cannot be decoupled.”

Iterators can be used to create a custom iteration over array or collection class.

Iterators can increase performance because they allow you to asynchronously consume the elements of a large collection.

Iterators can decrease memory use too.

Learn more by clicking: What's New for Visual Basic in Visual Studio 2012