C# में CharEnumerator.ToString() मेथड वर्तमान ऑब्जेक्ट को दर्शाने वाली एक स्ट्रिंग प्राप्त करता है।
सिंटैक्स
निम्नलिखित सिंटैक्स है -
public virtual string ToString();
उदाहरण
आइए CharEnumerator.ToString() मेथड को लागू करने का एक उदाहरण देखते हैं -
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());
Console.WriteLine("\nString representation = "+ch.ToString());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
ch.Reset();
Console.WriteLine();
while (ch.MoveNext())
Console.Write(ch.Current);
}
}
आउटपुट
यह निम्नलिखित आउटपुट देगा -
HashCode = 31020903 Get the Type = System.CharEnumerator String representation = System.CharEnumerator T h i s i s i t ! This is it!