ndoc2007
A lot has been said on this topic, but here's some stuff you might not know.
关于这个话题已经说了很多,但是这里有些东西你可能不知道。
We use NDoc to document our API. NDoc consumes the XML Documentation files created as a build artifact by the C# compiler.
我们使用NDoc来记录我们的API。 NDoc使用C#编译器创建的XML文档文件作为构建工件。
Here is the list of recommended XML Documentation tags from Microsoft.
这是Microsoft推荐的XML Documentation标记的列表。
Here is the extended list of tags supported by NDoc
这是NDoc支持的标签的扩展列表
Most links online that talk about XML Documentation in stop at and the standard stuff. Method documentation is interesting, but the real meat happens at the top of your Class declarations. That's where most of the prose is in MSDN documentation. Take a look at the Remarks section of the Socket Class in the MSDN Help for example.
关于XML文档的大多数在线链接都以和标准的开头。 方法文档很有趣,但真正的实质发生在类声明的顶部。 那是大多数散文在MSDN文档中的地方。 例如,请查看MSDN帮助中的Socket类的“备注”部分。
To achieve such a rich structure, organize your XML help thusly on the top of each class declaration:
为了实现这种丰富的结构,因此可以在每个类声明的顶部组织XML帮助:
- <摘要>
<备注>
(s)
<示例>
- (s) <另请参阅>
The XML Comment snippet below, along with NDoc produced the lovely MSDN-style documentation in the picture at right.
下方的XML Comment片段与NDoc一起在右图中生成了可爱的MSDN样式的文档。
The tag explains the “point” of the class. A sentence or two is fine here./// /// Encapsulates Thingie and a Connection to Thingie in a Service wrapper. /// Other Services will be built with this building block. /// The tag is where the real prose goes. Use this tag to describe the general use of the class, as well as any notes, gotchas, or significant design or architectural issues. Note the use of to separate paragraphs. Use to refer to namespaces, classes or methods. If you don’t include the fully qualified namespace, the documenter will assume the current namespace. /// <remarks>/// <para>The ThingieService class contains a <see cref&#61;"IConnector"/>/// that is pulled from the named element in the config/ThingieClient.config file. The config file/// is loaded by .para>/// <para>Note that the constructor is private, as your application gets a ThingieService by calling the static <see cref&#61;"GetThingieService"/> method. /// From there, the ThingieService hides the <see cref&#61;"IConnector"/> and/// is the primary interface to Thingie. The ThingieService shouldn&#39;t be used directly from an ASP.NET/// page. Instead, it should be used from either a generated or hand-written proxy.para>/// <note type&#61;"note">ASP.NET developers should use <see cref&#61;"Corillian.Thingie.Security.SiteSecureThing"/> to property register a <see cref&#61;"ThingiePrincipal"/> with the system to effectively use the ThingieService.note>/// <para>There are two ways to call the <see cref&#61;"Execute"/> method.para>/// <list type&#61;"bullet">/// <item>Pass in an object that implements <see cref&#61;"IRequest"/>. /// The Thingie SessionID and UserID will be retrieved from the on the current Thread.term>item>/// <item><term>Pass in an object that implements <see cref&#61;"IRequest"/> along with the Thingie SessionID and UserID as additional parameters. /// Use this method if your Thread doesn&#39;t already have a ThingiePrincipal. One will be made for you temporarily./// list>/// remarks>/// <example>/// <code>/// public class BankingExample/// {/// protected ThingieService thingie &#61; null;/// /// public BankingExample()/// {/// thingie &#61; ThingieService.GetThingieService("BankingServiceProxy");/// }/// /// public virtual SignonResponse Signon(SignonRequest req, string userId, string somethingElse ) /// {/// string sessionid &#61; thingie.SomethingImportantToTheSession(userId); /// string r &#61; thingie.Execute(req, sessionid, userId);/// SignonResponse retVal &#61; SignonResponse.FixUpSomething(r);/// return retVal;/// }/// }/// code>/// example>/// /// /// /// public class ThingieService....
标记解释了类的“要点”。 这里一两句话就可以了。 /// ///在服务包装器中封装Thingie和与Thingie的连接。 ///其他服务将使用此构建块构建。 /// summary> 标签是真正的散文去处。 使用此标记来描述类的常规用法以及任何注释&#xff0c;陷阱或重大的设计或体系结构问题。 注意使用分隔段落。 使用来引用名称空间&#xff0c;类或方法。 如果您不包括完全限定的名称空间&#xff0c;则记录器将采用当前的名称空间。 /// <备注> /// <para > ThingieService类包含一个<see cref &#61;“ IConnector” /> ///&#xff0c;它从config / ThingieClient.config文件中的命名元素中提取。 配置文件///由加载。 para > /// <para >请注意&#xff0c;构造函数是私有的&#xff0c;因为您的应用程序通过调用静态<see cref &#61; “ GetThingieService” />方法。 ///从那里&#xff0c;ThingieService隐藏<请参阅cref &#61;“ IConnector” />&#xff0c;并且///是Thingie的主要接口。 不应直接在ASP.NET ///页面上使用ThingieService 。 而是应从生成的或手写的代理中使用它。 para > /// <note type &#61;“ note”> ASP.NET开发人员应使用<请参阅cref &#61;“ Corillian.Thingie.Security.SiteSecureThing” />要向系统属性注册<请参阅cref &#61;“ ThingiePrincipal” />以有效使用ThingieService。 note > /// <para >有两种方法可以调用<请参阅cref &#61;“ Execute” />方法。 para > /// <list type &#61;“ bullet”> /// <item > 传入实现<的对象<请参见cref &#61;“ IRequest” />。 /// Thingie SessionID和UserID将从当前线程上的中检索。 term > item > /// <item > <term >传递实现的对象<请参阅cref &#61;“ IRequest” />以及Thingie SessionID和UserID作为附加参数。 ///如果您的线程还没有ThingiePrincipal&#xff0c;请使用此方法。 term> item> /// list > /// 备注> /// <example > /// <code > /// public class BankingExample // / { ///受保护的ThingieService物品&#61; null; /// /// public BankingExample() /// { /// thingie &#61; ThingieService.GetThingieService(“ BankingServiceProxy”); ///} /// ///公共虚拟SignonResponse Signon(SignonRequest请求&#xff0c;字符串userId&#xff0c;字符串somethingElse) /// { ///字符串sessionid &#61; Thietie.SomethingImportantToTheSession(userId); ///字符串r &#61; something.Execute(req&#xff0c;sessionid&#xff0c;userId); /// SignonResponse retVal &#61; SignonResponse.FixUpSomething(r); ///返回retVal; ///} ///} /// code > /// example > /// /// /// /// 公共类ThingieService...。
I also like to use Lutz Roeder&#39;s .NET Documentor to write my XML Comments in. It has a split-pane view and a nice right-click menu that let&#39;s me see what the documentation will look like AS I TYPE.
我还喜欢使用Lutz Roeder的.NET Documentor来编写我的XML注释。它具有一个拆分窗格视图和一个漂亮的右键菜单&#xff0c;让我看看文档的外观如何。
Considering that I&#39;d need to recompile the Application AND generate the MSDN documentation, this little tool is a big time saver.
考虑到我需要重新编译应用程序并生成MSDN文档&#xff0c;因此这个小工具可以节省大量时间。
翻译自: https://www.hanselman.com/blog/effective-xml-document-with-c-ndoc-lutzs-documentor-and-the-microsoft-html-help-workshop
ndoc2007