The related default StyleCop rules are:
using
statements inside namespace
.using
statements alphabetically.System
using
come first (still trying to figure out if that means just using System;
or using System[.*];
).So, my use case:
Debug.Assert(
and intellisense marks it in Red. I hover mouse over Debug
and between using System.Diagnostics;
and System.Diagnostics.Debug
I choose the former. This inserts using System.Diagnostics;
after all other using
statements. It would be nice if VS2010 did not assist me in writing code that won't build due to warnings as errors.How can I make VS2010 smarter? Is there some sort of setting, or does this require a full-fledged add-in of some sort?
For 2008, I use the Power Commands add-in. It includes a command to sort and remove unused using statements. I map that to Ctrl-O, Ctrl-R. It's not automatic, but it's very quick.
2010 has a Power Commands too, but I think the sort and order using statements stuff is now built in. You just need to set up a shortcut for it.
PS. I do not use Resharper because of the resource overhead. Every time I tell people that it thrashes my hard drive and drives memory usage through the roof, they tell me to "try the latest version - it's much better now". Suffice to say, it never has been... I do use CodeRush Xpress though.