class MyClass{ char chrs = 'A' ; public IEnumerator GetEnumerator() { for (int i = 20; i >=0; --i) if (i == 10) yield break; yield return (char)((chrs + i)); }}class Program{ static void Main(string[] args) { MyClass mc = new MyClass(); foreach (char ch in mc) Console.Write(ch + " "); Console.WriteLine(); Console.ReadLine(); }}
a) Code run successfully prints nothing
b) A B C D E F G H I J K L M N O P Q R S T U V
c) U T S R Q P O N M L
d) Compile time error
What will be the following C# code snippet specify?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What will be the following C# code snippet specify?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!