【问题标题】:StyleCop SA1630StyleCop SA1630
【发布时间】:2012-03-07 01:16:34
【问题描述】:

这些方法有什么区别,为什么 SortDropDown 是正确的,但 Page_load 和 GetCases 不是?

我无法理解。
以及如何解决这个问题?

编辑图片看不清楚

代码:

        /// <summary>
        /// Sort items in drop down list
        /// </summary>
        /// <param name="dropDown">Drop down list</param>
        internal static void SortDropDown(ref DropDownList dropDown)
        {

        }

        /// <summary>
        /// PageLoad event handler 
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event Args</param>
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// Get all cases by authority and ShopNo
        /// </summary>
        /// <param name="authority">Authority</param>
        /// <param name="shopNo">Shop No</param>
        /// <returns>Cases list</returns>
        private static IEnumerable<CaseSummary> GetCases(string authority, string shopNo)
        {

        }


谢谢!

【问题讨论】:

  • 请发布代码,而不是代码截图。这很难阅读,也无法编辑。

标签: c# stylecop


【解决方案1】:

您的某些参数只有一个单词作为文档,这显然是不够的(至少需要 10 个字符 + 至少需要一个空格)。

  • Sender
  • Authority

就这些参数的用途写一个有用的描述。

此外,对于事件处理程序,您确实应该采用 Microsoft 使用的文档文本:

/// <summary>
/// Handles the XXXXX event of YYYY.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>

【讨论】:

  • 谢谢,它有效!但是有必要放“。”吗?在描述的最后?还是类似“良好风格”的文档?
  • @andronz AFAIK,没有。但是至少需要 10 个字符,所以没有你的“.”可能还不够......
  • 我建议您使用正确的拼写、大小写和标点符号。
【解决方案2】:

不同之处在于文档使用一个词来描述Page_Load() 事件和GetCases() 方法的参数之一,而SortDropDown() 方法文档使用多个词来描述其参数。更具描述性,您将避免这种违反规则的行为。

【讨论】:

    猜你喜欢
    • 2011-01-23
    • 2013-03-15
    • 2011-05-07
    • 2010-12-25
    • 2010-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-21
    相关资源
    最近更新 更多