c# - 记录 C# 代码的规则/指南?

标签 c# c#-4.0 documentation

<分区>

我是一名相对较新的开发人员,被指派负责为高级 C# 开发人员编写的代码编写文档。我的老板告诉我仔细查看它,并记录下来,以便根据需要更容易地修改和更新。

我的问题是:是否有我应该遵循的标准类型的文档/注释结构?我的老板听起来好像每个人都知道如何按照特定标准记录代码,以便任何人都能理解。

我也很好奇是否有人有好的方法来找出不熟悉的代码或函数的不确定性。任何帮助将不胜感激。

最佳答案

标准好像是XML Doc (MSDN Technet 文章 here)。

您可以使用 ///在每行文档注释的开头。有用于记录代码的标准 XML 样式元素;每个都应该遵循标准 <element>Content</element>用法。以下是一些元素:

<c>               Used to differentiate code font from normal text 
                    <c>class Foo</c>
<code>
<example>
<exception>
<para>            Used to control formatting of documentation output. 
                    <para>The <c>Foo</c> class...</para>
<param>
<paramref>        Used to refer to a previously described <param>  
                    If <paramref name="myFoo" /> is <c>null</c> the method will...
<remarks>
<returns>
<see>             Creates a cross-ref to another topic. 
                     The <see cref="System.String" /><paramref name="someString"/>
                     represents...

<summary>         A description (summary) of the code you're documenting.                     

关于c# - 记录 C# 代码的规则/指南?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7535584/

相关文章:

c# - 如何避免设计器中按钮的文本集

r - 为 'texi2dvi' 设置 'R CMD Rd2pdf'

c# - ZedGraph 在 Visual Studio 2012 中不起作用

c# - 为什么 FileInfo 对象的 Name 属性以 "~$"开头?

c# - 模拟并发 WCF 客户端调用并测量响应时间

.net - 如何使用 MSBuild 搜索目录结构并获取 .sln 文件名

linq - LINQ 查询中子项的 OrderBy

java - 为 Javadoc 适当记录 Varargs

architecture - 编写可维护的事件驱动代码

c# - 如何为 out 参数指定 Ensures?