Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
CharEnumerator.MoveNext() Method in C#
The CharEnumerator.MoveNext() method in C# is used to increments the internal index of the current CharEnumerator object to the next character of the enumerated string.
Syntax
public bool MoveNext ();
Let us now see an example to implement the CharEnumerator.MoveNext() method −
Example
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);
}
}
Output
This will produce the following output −
HashCode = 1373506 Get the Type = System.CharEnumerator j o h n
Advertisements
