C# में CharEnumerator.GetType() विधि का उपयोग वर्तमान उदाहरण के प्रकार को प्राप्त करने के लिए किया जाता है।
सिंटैक्स
public Type GetType();
आइए अब हम CharEnumerator.GetType() विधि को लागू करने के लिए एक उदाहरण देखें -
उदाहरण
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