• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            C++ Programmer's Cookbook

            {C++ 基礎} {C++ 高級} {C#界面,C++核心算法} {設計模式} {C#基礎}

            XML Comments in C#

            Author: James Foster Date Posted: 09/02/2001 .NET Version: 1.0.3705
            Many of you have heard of JavaDoc, a feature of Java that automatically generates HTML documentation for your code. C#, and the C# compiler, is capable of a similar function, yet produces XML instead of directly producing HTML. This makes the documentation much more flexible.

            Commenting Syntax
            To use the XML commenting features of C#, you begin by commenting your source code using the special comment syntax, /// (three slashes). After the slashes you use one of the predefined tags for documentation comments, or embed your own. Your custom xml tags will carry over into the result XML documentation.

            Predefined TagUsed for
            <c>a way to indicate that text within a description should be marked as code
            <code>a way to indicate multiple lines as code
            <example>lets you specify an example of how to use a method or other library member
            <exception>lets you document an exception class
            <include>lets you refer to comments in another file, using XPath syntax, that describe the types and members in your source code.
            <list>Used to insert a list into the documentation file
            <para>Used to insert a paragraph into the documentation file
            <param>Describes a parameter
            <paramref>gives you a way to indicate that a word is a parameter
            <permission>lets you document access permissions
            <remarks>where you can specify overview information about the type
            <returns>describe the return value of a method
            <see>lets you specify a link
            <seealso>lets you specify the text that you might want to appear in a See Also section
            <summary>used for a general description
            <value>lets you describe a property
            Example
            The following example adds comments to our introductory HelloWorld console application.
            using System;

            namespace HelloWorld
            {
            ????/// <summary>
            ????/// Sample Hello World in C#
            ????/// </summary>
            ????publicclass HelloWorld
            ????{
            ????????/// <summary>
            ????????/// Console Application Entry Point
            ????????/// <param name="args">Command Line Arguments</param>
            ????????/// <returns>Status code of 0 on successful run</returns>
            ????????/// </summary>
            ????????publicstaticint Main(string[]args)
            ????????{
            ????????????System.Console.WriteLine("HelloWorld");
            ????????????stringname= System.Console.ReadLine();

            ????????????return(0);
            ????????}
            ????}
            }

            To get the resulting XML Documentation file, we call the csc compiler with the /doc option.

            csc /doc:HelloWorld.xml helloworld.cs 或修改工程的property.build.output.xmldocument.(在2005中)


            HTML Web Pages
            You may be asking yourself: how do I get nicely formatted web pages? Well, you could write your own XSL to transform the XML documentation file, or you could use Visual Studio.NET. By using the Tools -> Build Comment Web Pages option, you can get a set of html files detailing your entire project or solution. Here is a screen shot by building web pages for our HelloWorld example:


            But if you want to create easy-to-use, helpful, cross-referenced and attractive documentation, then I can strongly recommend the free, open source tool NDoc. The screenshot below is taken from a compiled help file produced from NDoc and is an example of the quality it can produce.



            可以把xml制作chm的工具
            NANT? 下載:http://nant.sourceforge.net/
            NDOC? 下載:http://ndoc.sourceforge.net/

            posted on 2006-04-13 14:02 夢在天涯 閱讀(834) 評論(1)  編輯 收藏 引用 所屬分類: C#/.NET

            評論

            # re: XML Comments in C# 2006-04-30 16:25 夢在天涯

            很好用的啊,但是好像沒有最新的支持.net 2.0的啊!  回復  更多評論   

            公告

            EMail:itech001#126.com

            導航

            統計

            • 隨筆 - 461
            • 文章 - 4
            • 評論 - 746
            • 引用 - 0

            常用鏈接

            隨筆分類

            隨筆檔案

            收藏夾

            Blogs

            c#(csharp)

            C++(cpp)

            Enlish

            Forums(bbs)

            My self

            Often go

            Useful Webs

            Xml/Uml/html

            搜索

            •  

            積分與排名

            • 積分 - 1811122
            • 排名 - 5

            最新評論

            閱讀排行榜

            99久久er这里只有精品18| 欧美色综合久久久久久| 婷婷久久久亚洲欧洲日产国码AV| 国内精品久久久久影院薰衣草| 日韩av无码久久精品免费| 狠狠色伊人久久精品综合网| 一本色道久久综合亚洲精品| 伊人色综合久久天天| 亚洲综合熟女久久久30p| 久久香蕉综合色一综合色88| 狠狠综合久久综合88亚洲| 51久久夜色精品国产| 人妻无码αv中文字幕久久琪琪布| 亚洲国产成人久久精品动漫| 中文字幕乱码久久午夜| 久久久久99精品成人片| 色综合久久久久网| 久久精品亚洲一区二区三区浴池| 久久人人爽人人爽人人片AV麻豆 | 亚洲AV无码久久精品色欲| 久久久久久A亚洲欧洲AV冫| 精品久久久久久国产潘金莲| 久久久久久精品无码人妻| 久久久久久毛片免费看| 国产福利电影一区二区三区久久久久成人精品综合 | 久久99精品国产麻豆宅宅| 亚洲AV日韩精品久久久久久| 亚洲欧美精品一区久久中文字幕| 精品久久综合1区2区3区激情| 青青青国产成人久久111网站| av无码久久久久久不卡网站| 色婷婷综合久久久久中文一区二区| 亚洲&#228;v永久无码精品天堂久久 | 亚洲伊人久久大香线蕉苏妲己 | 久久久亚洲精品蜜桃臀| 国产福利电影一区二区三区,免费久久久久久久精 | 99久久精品免费看国产一区二区三区| 亚洲?V乱码久久精品蜜桃| 久久久久亚洲AV片无码下载蜜桃| 久久久久久精品免费免费自慰| 久久亚洲精品成人无码网站 |