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