Welcome to MSDN Blogs Sign in | Join | Help

November 2007 - Posts

C# quiz answer - yes it compiles, and here's why

Got a few good comments to the quiz post , but nobody that commented got it right. I went ahead and sent the quiz on an internal C# mailing list, and to nobody's surprise, multiple people got it right :) The key bit of information is that the one thing
Posted by jmanning | 1 Comments

Today's C# quiz - does this compile?

using System; using System.Collections.Generic; class Program { static void Main( string [] args) { IEnumerable<Inter1> ienum1 = new Class1[] { new Class1() }; foreach (Class2 c in ienum1) { Console.WriteLine(c); } } } public interface Inter1 {
Posted by jmanning | 12 Comments
 
Page view tracker