Answer: Instantiating an interface
Well, that was a fun little quiz… I should have added “no scoping tricks” to the list of rules, but what Roy Osherove suggested does work. But Kevin Dente gives the answer I was looking for. Whenever you see something funny going on in the framework 9 out 10 times it is because of Com Interop ;-)… go figure:
using System.Runtime.InteropServices;
[CoClass(typeof(Foo))]
[Guid("00000000-0000-0000-0000-000000000000")]
[ComImport]
interface IFoo { }
public class Class1 {
static void Main() {
new IFoo();
}
}
class Foo : IFoo { }
Thanks again to the folks down-under for suggesting this quiz.