1.

What will be the output of the given code snippet?
 class MyClass { char[] chrs = { 'A', 'B', 'C', 'D' }; public System.Collections.IEnumerator GetEnumerator() { foreach (char ch in chrs) yield return ch; } } class Program { static void Main(string[] args) { MyClass mc = new MyClass(); foreach (char ch in mc) Console.Write(ch + " "); Console.WriteLine(); Console.ReadLine(); } } 

A. Run time error
B. Compile time error
C. Code runs successfully prints nothing
D. Code runs successfully prints A, B, C, D
Answer» E.


Discussion

No Comment Found