Phương thức CharEnumerator.GetType () trong C # được sử dụng để lấy kiểu của phiên bản hiện tại.
Cú pháp
public Type GetType();
Bây giờ chúng ta hãy xem một ví dụ để triển khai phương thức CharEnumerator.GetType () -
Ví dụ
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);
}
} Đầu ra
Điều này sẽ tạo ra kết quả sau -
HashCode = 1373506 Get the Type = System.CharEnumerator j o h n