- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
CharEnumerator.Reset() Method in C#
The CharEnumerator.Reset() method in C# initializes the index to a position logically before the first character of the enumerated string.
Syntax
public void Reset ();
Example
Let us now see an example to implement the CharEnumerator.Reset() method −
using System; public class Demo { public static void Main(){ string strNum = "This is it!"; CharEnumerator ch = strNum.GetEnumerator(); Console.WriteLine("HashCode = "+ch.GetHashCode()); Console.WriteLine("Get the Type = "+ch.GetType()); while (ch.MoveNext()) Console.Write(ch.Current + " "); ch.Reset(); Console.WriteLine(); while (ch.MoveNext()) Console.Write(ch.Current); } }
Output
This will produce the following output −
HashCode = 65311716 Get the Type = System.CharEnumerator T h i s i s i t ! This is it!
Advertisements