StyleCop 程式碼風格和常見警告訊息

每個檔案的最上面,都加一個檔頭
    // <copyright company=”CompanyName” file=”NameOfFile.cs”>
    //     Company copyright tag.
    // </copyright>

XML註解
    建構式以Initializes a new instance of the xxx class開頭
    解構式以Finalizes an instance of the xxx class開頭
    屬性以Gets or sets開頭
    註解文字最少兩個字以上,並用空格分隔
    註解文字斷行要用para分隔
   
程式碼撰寫順序
    程式碼撰寫順序: public -&gt; internal -&gt; protected internal -&gt; protected -&gt; private
    程式碼元素撰寫順序: Fields -&gt; Constructor -&gt; Event-&gt; Property -&gt; Method

大小寫規則
    Camel Case:私有的內部變數、成員變數、參數
    Pascal Case:公開的屬性、方法、事件…
   
其他
    using 放到namespace下面
    需使用明確的存取修飾詞
    程式碼中多餘的空白行
    變數不用使用底線

常見錯誤
    SA1633 : CSharp.Documentation : The file has no header, the header Xml is invalid, or the header is not located at the top of the file.
    在第一行加入檔頭資訊
   
    SA1200 : CSharp.Ordering : All using directives must be placed inside of the namespace.
    Using 放到namespace區段下面

    SA1027 : CSharp.Spacing : Tabs are not allowed. Use spaces instead.
    工具-&gt;選項-&gt;文字編輯器-&gt;所有語言-&gt;定位點-&gt;插入空格

    SA1400 : CSharp.Maintainability : The class must have an access modifier.
    加入明確存取修飾詞

    SA1600 : CSharp.Documentation : The class must have a documentation header.
    加入XML Document註解