C# | CharEnumerator.GetType() Method
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:
// C# program to illustrate the // use of CharEnumerator.GetType() // Method using System; class GFG { // Driver code public static void Main() { // Initialize a string object string str = "GeeksforGeeks is Awesome!" ; // Instantiate a CharEnumerator object CharEnumerator chEnum = str.GetEnumerator(); // Printing the Type of // the CharEnumerator objects Console.WriteLine(chEnum.GetType()); } } |
Output:
System.CharEnumerator
Example 2:
// C# program to illustrate the // use of CharEnumerator.GetType() // Method using System; class GFG { // Driver code public static void Main() { // Initialize a string object string str = "GeeksforGeeks is fun" ; // Instantiate a CharEnumerator object CharEnumerator chEnum = str.GetEnumerator(); // Instantiate a clone of CharEnumerator object CharEnumerator chEnumClone = (CharEnumerator)chEnum.Clone(); // Printing the Type of the // CharEnumerator objects and its 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
Please Login to comment...