[英]Order of imports in C#
您想如何在C#中安排“使用xxx”導入? 前幾天我很無聊,把它們從最短到最長的順序排列了。
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;
布賴恩
我想在源代碼編輯器中右鍵單擊-> Organize Usings
-> Remove and Sort
(來源: codeitwell.com )
StyleCop規則如下:
對於標准.NET命名空間,我傾向於按字母順序進行。 我總是將自定義/第三部分放在底部,我自己的放在第一(也按字母順序排列),例如
using System;
using System.Drawing;
using System.Threading;
using MyNamespace.Utils
using MyNamespace.Misc
using 3rdPartyTool.Utils
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.