C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String GetEnumerator()The C# GetEnumerator() method is used to convert string object into char enumerator. It returns instance of CharEnumerator. So, you can iterate string through loop. Signaturepublic CharEnumerator GetEnumerator() ParameterIt does not take any argument. ReturnIt returns System.CharEnumerator. C# String GetEnumerator() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s2 = "Hello C#"; CharEnumerator ch = s2.GetEnumerator(); while(ch.MoveNext()){ Console.WriteLine(ch.Current); } } } Output: H e l l o C #
Next TopicC# String GetHashCode()
|