What is CharEnumerator in C# ?

CharEnumerator is an object in C# that can be used to enumerate through all the characters of a string.

Sample Code :

string str = “santosh”;
CharEnumerator chs = str.GetEnumerator();
while(chs.MoveNext())
{
Response.Write(chs.Current);
}

Leave a Reply