Language Specification Version 0 Notice



Download 3.2 Mb.
Page81/85
Date29.01.2017
Size3.2 Mb.
1   ...   77   78   79   80   81   82   83   84   85

Recommended tags


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



A.2.1

Set text in a code-like font



A.2.2

Set one or more lines of source code or program output



A.2.3

Indicate an example



A.2.4

Identifies the exceptions a method can throw



A.2.5

Includes XML from an external file



A.2.6

Create a list or table




A.2.7

Permit structure to be added to text




A.2.8

Describe a parameter for a method or constructor




A.2.9

Identify that a word is a parameter name




A.2.10

Document the security accessibility of a member



A.2.11

Describe a type



A.2.12

Describe the return value of a method



A.2.13

Specify a link



A.2.14

Generate a See Also entry



A.2.15

Describe a member of a type



A.2.16

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 (§A.2.2).

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 (§A.2.1).

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 A.2.2) as well.

Syntax:

description

Example:

See (§A.2.2) 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
A.2.11) or A.2.12), 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 overview information about a type. (Use A.2.15) to describe the members of a type.)

Syntax:

description

where


description

The text of the summary.



Example:

///

Class Point models a point in a


/// two-dimensional plane.

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 A.2.14) 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 A.2.13) 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 member for a type. Use A.2.11) to describe the type itself.

Syntax:

description

where


description

A summary of the 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) {


...
}


Download 3.2 Mb.

Share with your friends:
1   ...   77   78   79   80   81   82   83   84   85




The database is protected by copyright ©ininet.org 2020
send message

    Main page