日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

FxCop命名规则

發布時間:2025/5/22 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 FxCop命名规则 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

四、?Naming(命名)
1.?Avoid language specific type names in parameters
避免在參數中使用與特定語言相關的類型(用Uint16代替Ushort)

2.?Avoid type names in parameters
避免在外部可見的參數中使用類型名

3.?Compound words should be cased correctly
復合詞應該使用正確的大小寫(不要將Mutlipart寫成MultiPart,也不要將ToolBar寫成Toolbar,FileName寫成Filename)

4.?Do not name enum values 'Reserved'
不要在枚舉值中使用保留字

5.?Do not prefix enum values with type name
不要在枚舉值使用類型前綴(比如不要使用Digital之類的前綴)

6.?Events should not have before or after prefix
事件的名稱不應該包含before和after前綴(盡量使用ing和ed的后綴)

7.?Flags enums should have plural names
標記有System.FlagsAttribute特性的枚舉應該使用復數形式的名稱

8.?Identifiers should be cased correctly
標示符(名字空間、類名、屬性名、接口名、方法名等)應該使用正確的大小寫(通常以大寫開頭,以后的每個單詞都首字母大寫)

9.?Identifiers should be spelled correctly
標示符應該可以被正確的劃分為不同的單詞

10.?Identifiers should differ by more than case
標示符應該不止有大小寫上的不同(因為某些語言是不區分大小寫的)

11.?Identifiers should have correct prefix
標示符應該使用正確的前綴(接口應該使用字母I開頭)

12.?Identifiers should have correct suffix
標示符應該使用正確的后綴
System.Attribute/Attribute
System.EventArgs/EventArgs
System.Exception/Exception
System.Collections.ICollection/Collection
System.Collections.IDictionary/Dictionary
System.Collections.IEnumerable/Collection
System.Collections.Queue/Collection or Queue
System.Collections.Stack/Collection or Stack
System.Collections.Generic.ICollection/Collection
System.Collections.Generic.IDictionary/Dictionary
System.Data.DataSet/DataSet
System.Data.DataTable/Collection or DataTable
System.IO.Stream/Stream
System.Security.IPermission/Permission
System.Security.Policy.IMembershipCondition/Condition
An event-handlerdelegate./EventHandler

13.?Identifiers should not contain underscores
標示符不應該使用下劃線

14.?Identifiers should not have incorrect prefix
標示符不應該使用不正確的前綴(比如不應使用一個字母作為前綴)

15.?Identifiers should not have incorrect suffix
標示符不應該使用不正確的后綴(不要在不正確的地方使用12中提及的后綴名,和Delegate、Enum、Flags for an enumeration、Impl等后綴名)

16.?Identifiers should not match keywords
標示符不應該與系統關鍵字沖突

17.?Long acronyms should be pascal-cased
長度大于等于3的縮寫詞應該使用pascal的命名規則,即首字母大寫

18.?Only FlagsAttribute enums should have plural names
只有標記有System.FlagsAttribute特性的枚舉的名稱才應該使用復數,其他時候應該使用單數

19.?Parameter names should match base declaration
派生項的參數名應該同基項相吻合(派生類重寫或實現的方法應該同基項具有相同的參數名)

20.?Parameter names should not match member names
方法的參數名不應該同類或接口的成員名一樣

21.?Property names should not match get methods
屬性名字不應該同Get開頭的方法的名稱的后半部分相同

22.?Resource string compound words should be cased correctly
包含符合單詞的資源字符串應該使用正確的大小寫(每個單詞的首字母大寫)

23.?Resource strings should be spelled correctly
資源字符串應該正確的拼寫

24.?Short acronyms should be uppercase
短的首字母縮寫詞應該全部大寫(比如DB,CR)

25.?Type names should not match namespaces
類型的名字不應該與名字空間的名字相同
?
26.?Use preferred terms
優先使用某些項目或者名稱,以下這些,后者為優先使用的
ComPlus/EnterpriseServices
Cancelled/Canceled
Indices/Indexes
LogIn/LogOn
LogOut/LogOff
SignOn/SignIn
SignOff/SignOut
Writeable/Writable


?

轉載于:https://www.cnblogs.com/QuitGame/archive/2005/08/25/222383.html

總結

以上是生活随笔為你收集整理的FxCop命名规则的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。