以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Dot NET,C#,ASP,VB 』  (http://bbs.xml.org.cn/list.asp?boardid=43)
----  C#快餐-11  (http://bbs.xml.org.cn/dispbbs.asp?boardid=43&rootid=&id=11725)


--  作者:admin
--  发布时间:11/9/2004 2:25:00 AM

--  C#快餐-11


发信人: nice (春天), 信区: DotNET        
标  题: C#快餐-11
发信站: BBS 水木清华站 (Thu Jul 26 02:14:58 2001)


Lesson 11. Creating online documentation

  C# allows automatic generation of comments in XML format. XML is similar to  
HTML and I will discuss it later in more details. For now lets concentrate  
on C#. Note that all programs in this lessons need to be compiled with the  
option /doc. For example if you save the program below in a file hello.cs and  
want to generate hello.xml you would type csc /doc:hello.xml hello.cs .To  
generate an XML file from a C# program we add triple slash comments /// .  

The simplest comment starts with a keyword  <summary>  and ends with a keyword <
\summary> . Comments should be placed just before the line of code they are  
annotating.

//This is just a comment
using System;
///<summary> class Test has only one method </summary>
class Test
{
    ///<summary> string z contains identifier to output </summary>
    private static string z="Hello";
    ///<summary> method Main is an entry point of the program </summary>
    public static void Main()
    {
    Console.WriteLine(z);
    }
}


   Let's look inside hello.xml. which captures the general structure of the  
program  hello.cs  Here is a small dictionary

T Type. Class Test is a type.
F Class member. z is a data member of class Test.
M Method. Main is a method of class Test.
! Error. Dead link.
P Property.
.
  <?xml version="1.0" ?>
- <doc>
- <assembly>
  <name>comment</name>
  </assembly>
- <members>
- <member name="T:Test">
  <summary>class Test has only one method</summary>
  </member>
- <member name="F:Test.z">
  <summary>string z contains identifier to output</summary>
  </member>
- <member name="M:Test.Main">
  <summary>method Main is an entry point of the program</summary>
  </member>
  </members>
  </doc>
Other interesting commands are:
<seealso cref="Something" /> gives a link to Something which must be in  
your program file.
<para> and </para> mark the begining and the end of the paragraph.
<remarks> </remarks> Similar to <summary>
There are also other elements which I will explain in more detail after I wr
ite an introduction to XML.

--

※ 修改:·walts 於 Jul 26 10:27:48 修改本文·[FROM: 166.111.142.118]
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.176.234]
上一篇
返回上一页
回到目录
回到页首
下一篇



W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
19,470.700ms