Answer: CharEnumerator is an object in C# that can be used to enumerate through all the characters of a string. Below is the sample to do that
string str = "my name";
CharEnumerator chs = str.GetEnumerator();
while(chs.MoveNext())
{
Response.Write(chs.Current);
}
Moderator: please do not move this to Code section, this is a typical interview question that was asked :)
Asked In: Many Interviews |
Alert Moderator