Rather than calling the GetEnumerator method to retrieve a CharEnumerator object that you then use to enumerate a string, you should instead use your language's iteration construct (foreach in C#, for each in C++/CLR, and For Each in Visual Basic).
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.
The following example iterates the characters in several strings and displays information about their individual characters. It uses the language iteration construct rather than a call to the GetEnumerator method.