The documentation generator must accept and process any tag that is valid according to the rules of XML. The following tags provide commonly used functionality in user documentation. (Of course, other tags are possible.)
Tag
|
Section
|
Purpose
|
|
D
|
Set text in a code-like font
|
|
E
|
Set one or more lines of source code or program output
|
|
F
|
Indicate an example
|
|
G
|
Identifies the exceptions a method can throw
|
|
H
|
Includes XML from an external file
|
|
I
|
Create a list or table
|
|
J
|
Permit structure to be added to text
|
|
K
|
Describe a parameter for a method or constructor
|
|
L
|
Identify that a word is a parameter name
|
|
M
|
Document the security accessibility of a member
|
|
N
|
Describe additional information about a type
|
|
O
|
Describe the return value of a method
|
|
P
|
Specify a link
|
|
Q
|
Generate a See Also entry
|
|
R
|
Describe a type or a member of a type
|
|
S
|
Describe a property
|
|
|
Describe a generic type parameter
|
|
|
Identify that a word is a type parameter name
|
This tag provides a mechanism to indicate that a fragment of text within a description should be set in a special font such as that used for a block of code. For lines of actual code, use (§E).
Syntax:
text
Example:
/// Class Point models a point in a two-dimensional
/// plane.
public class Point
{
// ...
}
This tag is used to set one or more lines of source code or program output in some special font. For small code fragments in narrative, use (§D).
Syntax:
source code or program output
Example:
/// This method changes the point's location by
/// the given x- and y-offsets.
/// For example:
///
/// Point p = new Point(3,5);
/// p.Translate(-1,3);
///
/// results in p's having the value (2,8).
///
///
public void Translate(int xor, int yor) {
X += xor;
Y += yor;
}
This tag allows example code within a comment, to specify how a method or other library member may be used. Ordinarily, this would also involve use of the tag (§E) as well.
Syntax:
description
Example:
See (§E) for an example.
This tag provides a way to document the exceptions a method can throw.
Syntax:
description
where
cref="member"
The name of a member. The documentation generator checks that the given member exists and translates member to the canonical element name in the documentation file.
description
A description of the circumstances in which the exception is thrown.
Example:
public class DataBaseOperations
{
///
///
public static void ReadRecord(int flag) {
if (flag == 1)
throw new MasterFileFormatCorruptException();
else if (flag == 2)
throw new MasterFileLockedOpenException();
// …
}
}
This tag allows including information from an XML document that is external to the source code file. The external file must be a well-formed XML document, and an XPath expression is applied to that document to specify what XML from that document to include. The tag is then replaced with the selected XML from the external document.
Syntax:
path="xpath" />
where
file="filename"
The file name of an external XML file. The file name is interpreted relative to the file that contains the include tag.
path="xpath"
An XPath expression that selects some of the XML in the external XML file.
Example:
If the source code contained a declaration like:
/// "docs.xml" path='extradoc/class[@name="IntList"]/*' />
public class IntList { … }
and the external file “docs.xml” had the following contents:
"1.0"?>
"IntList">
Contains a list of integers.
"StringList">
Contains a list of integers.
then the same documentation is output as if the source code contained:
///
/// Contains a list of integers.
///
public class IntList { … }
This tag is used to create a list or table of items. It may contain a block to define the heading row of either a table or definition list. (When defining a table, only an entry for term in the heading need be supplied.)
Each item in the list is specified with an - block. When creating a definition list, both term and description must be specified. However, for a table, bulleted list, or numbered list, only description need be specified.
Syntax:
term
description
-
term
description
…
-
term
description
where
term
The term to define, whose definition is in description.
description
Either an item in a bullet or numbered list, or the definition of a term.
Example:
public class MyClass
{
/// Here is an example of a bulleted list:
///
/// -
/// Item 1.
///
/// -
/// Item 2.
///
///
///
public static void Main () {
// ...
}
}
This tag is for use inside other tags, such as (§N) or (§O), and permits structure to be added to text.
Syntax:
content
where
content
The text of the paragraph.
Example:
/// This is the entry point of the Point class testing program.
///
This program tests each method and operator, and
/// is intended to be run after any non-trvial maintenance has
/// been performed on the Point class.
public static void Main() {
// ...
}
This tag is used to describe a parameter for a method, constructor, or indexer.
Syntax:
name ">description
where
name
The name of the parameter.
description
A description of the parameter.
Example:
/// This method changes the point's location to
/// the given coordinates.
///
the new x-coordinate.
///
the new y-coordinate.
public void Move(int xor, int yor) {
X = xor;
Y = yor;
}
This tag is used to indicate that a word is a parameter. The documentation file can be processed to format this parameter in some distinct way.
Syntax:
name"/>
where
name
The name of the parameter.
Example:
/// This constructor initializes the new Point to
/// (
,
).
///
the new Point's x-coordinate.
///
the new Point's y-coordinate.
public Point(int xor, int yor) {
X = xor;
Y = yor;
}
This tag allows the security accessibility of a member to be documented.
Syntax:
member">description
where
cref="member"
The name of a member. The documentation generator checks that the given code element exists and translates member to the canonical element name in the documentation file.
description
A description of the access to the member.
Example:
///
Everyone can
/// access this method.
public static void Test() {
// ...
}
This tag is used to specify extra information about a type. (Use (§R) to describe the type itself and the members of a type.)
Syntax:
description
where
description
The text of the remark.
Example:
/// Class Point models a point in a
/// two-dimensional plane.
/// Uses polar coordinates
public class Point
{
// ...
}
This tag is used to describe the return value of a method.
Syntax:
description
where
description
A description of the return value.
Example:
/// Report a point's location as a string.
/// A string representing a point's location, in the form (x,y),
/// without any leading, trailing, or embedded whitespace.
public override string ToString() {
return "(" + X + "," + Y + ")";
}
This tag allows a link to be specified within text. Use (§Q) to indicate text that is to appear in a See Also section.
Syntax:
where
cref="member"
The name of a member. The documentation generator checks that the given code element exists and changes member to the element name in the generated documentation file.
Example:
/// This method changes the point's location to
/// the given coordinates.
///
public void Move(int xor, int yor) {
X = xor;
Y = yor;
}
/// This method changes the point's location by
/// the given x- and y-offsets.
///
///
public void Translate(int xor, int yor) {
X += xor;
Y += yor;
}
This tag allows an entry to be generated for the See Also section. Use (§P) to specify a link from within text.
Syntax:
where
cref="member"
The name of a member. The documentation generator checks that the given code element exists and changes member to the element name in the generated documentation file.
Example:
/// This method determines whether two Points have the same
/// location.
///
///
public override bool Equals(object o) {
// ...
}
This tag can be used to describe a type or a member of a type. Use (§N) to describe the type itself.
Syntax:
description
where
description
A summary of the type or member.
Example:
/// This constructor initializes the new Point to (0,0).
public Point() : this(0,0) {
}
This tag allows a property to be described.
Syntax:
property description
where
property description
A description for the property.
Example:
/// Property X represents the point's x-coordinate.
public int X
{
get { return x; }
set { x = value; }
}
This tag is used to describe a generic type parameter for a class, struct, interface, delegate, or method.
Syntax:
description
where
name
The name of the type parameter.
description
A description of the type parameter.
Example:
/// A generic list class.
/// The type stored by the list.
public class MyList {
...
}
This tag is used to indicate that a word is a type parameter. The documentation file can be processed to format this type parameter in some distinct way.
Syntax:
where
name
The name of the type parameter.
Example:
/// This method fetches data and returns a list of ”/>”> .
///
query to execute
public List FetchData(string query) {
...
}
Do'stlaringiz bilan baham: |