C# | CharEnumerator.GetType() Method
Last Updated :
30 Apr, 2019
CharEnumerator.GetType() Method is used to get the type of the current instance. This method is inherited from the Object Class.
Syntax:
public Type GetType();
Return Value: This method returns the exact runtime type of the current instance.
Below are the programs to illustrate the use of CharEnumerator.GetType() Method:+
Example 1:
using System;
class GFG {
public static void Main()
{
string str = "GeeksforGeeks is Awesome!" ;
CharEnumerator chEnum = str.GetEnumerator();
Console.WriteLine(chEnum.GetType());
}
}
|
Output:
System.CharEnumerator
Example 2:
using System;
class GFG {
public static void Main()
{
string str = "GeeksforGeeks is fun" ;
CharEnumerator chEnum = str.GetEnumerator();
CharEnumerator chEnumClone = (CharEnumerator)chEnum.Clone();
Console.WriteLine( "Type of CharEnumerator object: "
+ chEnum.GetType());
Console.WriteLine( "Type of CharEnumerator clone object: "
+ chEnumClone.GetType());
}
}
|
Output:
Type of CharEnumerator object: System.CharEnumerator
Type of CharEnumerator clone object: System.CharEnumerator
Share your thoughts in the comments
Please Login to comment...