System.Net.NetworkInformation.IPAddressInformationCollection.GetEnumerator Method

Returns an object that can be used to iterate through this collection.

Syntax

public virtual IEnumerator<IPAddressInformation> GetEnumerator ()

Returns

An object that implements the IEnumerator interface and provides access to the System.Net.NetworkInformation.IPAddressInformation types in this collection.

Remarks

The object that is returned by this method is initially positioned before the first element in this collection. You must call the IEnumerator.MoveNext method before you can access the first element. To access the element at the current position, call the IEnumerator.Current property.

Do not modify the collection while using the enumerator. If the collection is modified while an enumerator is in use, an attempt to set the position by calling IEnumerator.MoveNext or IEnumerator.Reset causes an InvalidOperationException.

For a detailed description of enumerators, see the documentation for the IEnumerator class and the IEnumerable.GetEnumerator method.

Requirements

Namespace: System.Net.NetworkInformation
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0