System.String.GetEnumerator Method

Retrieves an object that can iterate through the individual characters in this string.

Syntax

public CharEnumerator GetEnumerator ()

Returns

An enumerator object.

Remarks

This method enables you to iterate the individual characters in a string. For example, the Visual Basic For Each and C# foreach statements invoke this method to return a CharEnumerator object that can provide read-only access to the characters in this string instance.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0