代码之家  ›  专栏  ›  技术社区  ›  Germstorm Pierre-Alain Vigeant

C评论教程[关闭]

  •  8
  • Germstorm Pierre-Alain Vigeant  · 技术社区  · 16 年前

    我想知道哪一种材料是我能提供给学生的最好的。” C评论 “。

    4 回复  |  直到 16 年前
        1
  •  2
  •   NikolaiDante    16 年前

    这对于XML注释来说非常有趣: http://thoughtpad.net/alan-dean/cs-xml-documentation.html

    这些是读过的 sandcastle 太…o)

        2
  •  12
  •   George Stocker NotMe    16 年前

    This Post 杰夫·阿特伍德在他的博客上 Coding Horror 一般来说是为了评论的目的。你可能会认为“duh”实际上不是——尤其是在“现实世界”中,当你看到如下评论时:

    //Connect to the Database
    Db.Connect();
    

    当然,这篇文章的推论是: Coding Without Comments .

        3
  •  12
  •   Peter M    16 年前

    不久前我读到的东西(已经不知道在哪里了)是:

    • 初学者无意见
    • 学徒评论显而易见
    • 旅游者评论做这件事的原因
    • 大师们评论了不以另一种方式做这件事的原因。
        4
  •  2
  •   Patrick Desjardins    16 年前

    内部vs

    评论相对简单。

    你可以用 单线 :

    //This is a single line comment
    

    你可以用 多线 :

    /*
    Multiple lines
    */
    

    为了 方法 你可以使用:

        /// <summary>
        /// This is a description
        /// </summary>
        /// <param name="sender">Description of variable SENDER</param>
        /// <param name="e">Description of variable E</param>
    

    外部VS

    当你进入 项目属性 可以将所有注释输出到XML中并对其进行操作。

    良好实践

    注释不应该用来描述代码的作用,而应该用来描述如果代码不清楚的原因或方式。