Order of imports in C#
How do you like to arrange your "using xxx" imports in C#? I got bored the other day and put the开发者_开发百科m in order from shortest to longest.
using System;
using System.Web;
using System.Data;
using System.Linq;
using System.Web.UI;
using Telerik.Web.UI;
using System.Drawing;
using System.Collections;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Collections.Generic;
Brian
I like to right click in the source code editor -> Organize Usings
-> Remove and Sort
(source: codeitwell.com)
Sort Usings
StyleCop rules are the following:
- System namespaces first.
- Alphabetical sorting.
I tend to do it in alphabetical order for the standard .NET namespaces. I always put custom/3rd part ones at the bottom with my own ones being first (in alphatical order also) e.g.
using System;
using System.Drawing;
using System.Threading;
using MyNamespace.Utils
using MyNamespace.Misc
using 3rdPartyTool.Utils
精彩评论