C# में CharEnumerator.Reset() विधि इंडेक्स को एन्यूमरेटेड स्ट्रिंग के पहले वर्ण से पहले तार्किक रूप से एक स्थिति में प्रारंभ करती है।
सिंटैक्स
public void Reset ();
उदाहरण
आइए अब हम CharEnumerator.Reset() विधि को लागू करने के लिए एक उदाहरण देखें -
using System;
public class Demo {
public static void Main(){
string strNum = "This is it!";
CharEnumerator ch = strNum.GetEnumerator();
Console.WriteLine("HashCode = "+ch.GetHashCode());
Console.WriteLine("Get the Type = "+ch.GetType());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
ch.Reset();
Console.WriteLine();
while (ch.MoveNext())
Console.Write(ch.Current);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
HashCode = 65311716 Get the Type = System.CharEnumerator T h i s i s i t ! This is it!