C# Featurette #3 from Eric Gunnerson

Eric describes a new Whidbey feature focused on creating those ‘utility’ classes in the style of System.Math or System.Environment:

C# Whidbey Featurette #3: Static classes

Because all functions in C# must live inside of a class, there are some clases – System.Math is a canonical example – that are merely collections of static methods. Since it’s useless to create an instance of such a class, in current versions of C#, you can protect against this by creating a private constructor. The constructor can never be called, and therefore no instance can be created.

There are three issues with this approach:

Of course, you’ll have to click on the title of his post to read more 🙂

[Listening to: Do This Anymore – Nickelback – The Long Road (04:04)]


Author: Duncan Mackenzie

I'm the Developer Lead for the Channel 9 team, formerly worked on MSDN as a developer, content strategist and author.

Leave a Reply