现在的位置: 首页 > 综合 > 正文

[Tip: C# commenting]Comment in C# for VS

2012年09月14日 ⁄ 综合 ⁄ 共 863字 ⁄ 字号 评论关闭

there are three types of commenting syntax in C#:multiline, single line, and XML.

XML Documentation Comments
In addition to providing code commenting, an XML documentation comment supports tools that extract comments into an external XML document. This XML can be consumed
by tools or run through XSLT style sheets to produce readable documentation. This is what Microsoft uses to document the .NET FCL APIs that you see in the VS2008 help files. 

The .NET C# compiler has an option that reads the XML documentation comments and generates XML documentation from them. XML documentation is extracted to a separate
XML file that can then be processed by a tool for creating human-readable documentation.
Here’s an example of a command line you can use to get the C# compiler to create an XML documentation file from XML documentation comments in a C# source code file:
csc /doc:ProgramComments.xml Program.cs.

And you can also tell VS compiler to generate such xml file by project setting: Build -> Output -> XML documentation File.

抱歉!评论已关闭.