Things the compiler won't spot

Chapter 7: Concluding C# 2: the final features: 7.2

Created: 2/24/2008
Last updated: 2/24/2008

The C# team missed a few potential restrictions on static classes - things you can do but shouldn't really be able to. I suspect very few people have ever noticed this, but you can find the default value of a static class: default(MyStaticClass).

The compiler spots if you try to use this for type inference in the cases I've tried, but it's possible that you can trick it if you work hard enough.