ExamVeda
Login
Home
Miscellaneous in C Sharp
?

What will be the following C# code snippet specify?
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();
    }
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.