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();
// यह त्रुटि दिखाएगा क्योंकि हमने ऊपर ऑब्जेक्ट को डिस्पोज़ कर दिया है
// Console.WriteLine(ch.Current);
}
}
आउटपुट
यह निम्नलिखित आउटपुट देगा -
HashCode = 1373506 Get the Type = System.CharEnumerator j o h n