Default using directives in new C# files

compie picture compie · Mar 16, 2009 · Viewed 12.8k times · Source

Why does Visual Studio 2008 automatically insert the following using directives into each new C# file I create?

using System; 
using System.Collections.Generic; 
using System.Text;

What's so special about these namespaces? Are these the most frequently used ones?

Answer

Jon Skeet picture Jon Skeet · Mar 16, 2009

Yes, they're frequently used, that's all, so MS put them in the Visual Studio templates. Personally I use "sort and remove unused usings" pretty frequently, so they often go away.

If you want to remove them, you can amend the "new class" template.

EDIT: If you become a fan of "Sort and Remove Unused Using Directives" you should get hold of PowerCommands for Visual Studio - that adds a Solution Explorer context menu item to do it for a whole project instead of just one file :)