C# में CharEnumerator.MoveNext () विधि का उपयोग वर्तमान CharEnumerator ऑब्जेक्ट की आंतरिक अनुक्रमणिका को एन्यूमरेटेड स्ट्रिंग के अगले वर्ण तक बढ़ाने के लिए किया जाता है।
सिंटैक्स
public bool MoveNext ();
आइए अब हम CharEnumerator.MoveNext() विधि को लागू करने के लिए एक उदाहरण देखें -
उदाहरण
using System;
public class Demo {
public static void Main(){
string strNum = "john";
CharEnumerator ch = strNum.GetEnumerator();
Console.WriteLine("HashCode = "+ch.GetHashCode());
Console.WriteLine("Get the Type = "+ch.GetType());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
// disposed
ch.Dispose();
// this will show an error since we disposed the object above
// Console.WriteLine(ch.Current);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
HashCode = 1373506 Get the Type = System.CharEnumerator j o h n