Skip to content

Commit d242824

Browse files
authored
Example metadata: documentation-comments.md (#707)
* revise example metadata * correct xml output
1 parent 1d6a7b1 commit d242824

File tree

1 file changed

+37
-68
lines changed

1 file changed

+37
-68
lines changed

standard/documentation-comments.md

Lines changed: 37 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ In a *Delimited_Doc_Comment*, if the first non-*Whitespace* character on the sec
3434

3535
**Example:**
3636

37-
<!-- Example: {template:"standalone-lib", name:"DCIntroduction", replaceEllipsis:true} -->
37+
<!-- Example: {template:"standalone-lib-without-using", name:"DCIntroduction", replaceEllipsis:true} -->
3838
```csharp
3939
/// <summary>
4040
/// Class <c>Point</c> models a point in a two-dimensional plane.
@@ -98,7 +98,7 @@ This tag provides a mechanism to indicate that a fragment of text within a descr
9898

9999
**Example:**
100100

101-
<!-- Example: {template:"standalone-lib", name:"TagC"} -->
101+
<!-- Example: {template:"standalone-lib-without-using", name:"TagC"} -->
102102
```csharp
103103
/// <summary>
104104
/// Class <c>Point</c> models a point in a two-dimensional plane.
@@ -118,7 +118,7 @@ This tag is used to set one or more lines of source code or program output in so
118118

119119
**Example:**
120120

121-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagCode", ignoredWarnings:["CS1591"]} -->
121+
<!-- Example: {template:"standalone-lib-without-using", name:"TagCode", ignoredWarnings:["CS1591"], replaceEllipsis:true} -->
122122
```csharp
123123
public class Point
124124
{
@@ -167,7 +167,7 @@ where
167167

168168
**Example:**
169169

170-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagException", ignoredWarnings:["CS1591"]} -->
170+
<!-- Example: {template:"standalone-lib-without-using", name:"TagException", ignoredWarnings:["CS1591"], replaceEllipsis:true} -->
171171
```csharp
172172
class MasterFileFormatCorruptException : System.Exception { ... }
173173
class MasterFileLockedOpenException : System.Exception { ... }
@@ -212,7 +212,7 @@ where
212212

213213
If the source code contained a declaration like:
214214

215-
<!-- IncludeFileNeededExample: {template:"standalone-lib", name:"TagInclude", replaceEllipsis:true} -->
215+
<!-- Example: {template:"standalone-lib-without-using", name:"TagInclude1", replaceEllipsis:true} -->
216216
```csharp
217217
/// <include file="docs.xml" path='extradoc/class[@name="IntList"]/*' />
218218
public class IntList { ... }
@@ -238,7 +238,8 @@ and the external file “docs.xml” had the following contents:
238238

239239
then the same documentation is output as if the source code contained:
240240

241-
```xml
241+
<!-- Example: {template:"standalone-lib-without-using", name:"TagInclude2", replaceEllipsis:true} -->
242+
```csharp
242243
/// <summary>
243244
/// Contains a list of integers.
244245
/// </summary>
@@ -278,7 +279,7 @@ where
278279

279280
**Example:**
280281

281-
<!-- Example: {template:"standalone-lib", name:"TagList", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
282+
<!-- Example: {template:"standalone-lib-without-using", name:"TagList", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
282283
```csharp
283284
public class MyClass
284285
{
@@ -313,7 +314,7 @@ where
313314

314315
**Example:**
315316

316-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagPara", replaceEllipsis:true, expectedErrors:["x","x"], expectedWarnings:["x","x"]} -->
317+
<!-- Example: {template:"standalone-lib-without-using", name:"TagPara", replaceEllipsis:true} -->
317318
```csharp
318319
public class Point
319320
{
@@ -346,7 +347,7 @@ where
346347

347348
**Example:**
348349

349-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagParam", ignoredWarnings:["CS1591"]} -->
350+
<!-- Example: {template:"standalone-lib-without-using", name:"TagParam", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
350351
```csharp
351352
public class Point
352353
{
@@ -377,7 +378,7 @@ where
377378

378379
**Example:**
379380

380-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagParamref", ignoredWarnings:["CS1591"]} -->
381+
<!-- Example: {template:"standalone-lib-without-using", name:"TagParamref", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
381382
```csharp
382383
public class Point
383384
{
@@ -408,7 +409,7 @@ where
408409

409410
**Example:**
410411

411-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagPermission", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
412+
<!-- Example: {template:"standalone-lib-without-using", name:"TagPermission", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
412413
```csharp
413414
public class MyClass
414415
{
@@ -436,7 +437,7 @@ where
436437

437438
**Example:**
438439

439-
<!-- Example: {template:"standalone-lib", name:"TagRemarks", replaceEllipsis:true} -->
440+
<!-- Example: {template:"standalone-lib-without-using", name:"TagRemarks", replaceEllipsis:true} -->
440441
```csharp
441442
/// <summary>
442443
/// Class <c>Point</c> models a point in a two-dimensional plane.
@@ -464,7 +465,7 @@ where
464465

465466
**Example:**
466467

467-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagReturns", replaceEllipsis:true, expectedErrors:["x","x"], expectedWarnings:["x","x"]} -->
468+
<!-- Example: {template:"standalone-lib-without-using", name:"TagReturns", replaceEllipsis:true} -->
468469
```csharp
469470
public class Point
470471
{
@@ -476,6 +477,8 @@ public class Point
476477
/// without any leading, trailing, or embedded whitespace.
477478
/// </returns>
478479
public override string ToString() => $"({X},{Y})";
480+
public int X { get; set; }
481+
public int Y { get; set; }
479482
}
480483
```
481484

@@ -495,7 +498,7 @@ where
495498

496499
**Example:**
497500

498-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagSee", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
501+
<!-- Example: {template:"standalone-lib-without-using", name:"TagSee", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
499502
```csharp
500503
public class Point
501504
{
@@ -532,7 +535,7 @@ where
532535

533536
**Example:**
534537

535-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagSeealso", replaceEllipsis:true, expectedErrors:["CS0161"], expectedWarnings:["CS0659"]} -->
538+
<!-- Example: {template:"standalone-lib-without-using", name:"TagSeealso", replaceEllipsis:true, expectedErrors:["CS0161"], expectedWarnings:["CS0659"]} -->
536539
```csharp
537540
public class Point
538541
{
@@ -562,7 +565,7 @@ where
562565

563566
**Example:**
564567

565-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagSummary", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
568+
<!-- Example: {template:"standalone-lib-without-using", name:"TagSummary", replaceEllipsis:true, ignoredWarnings:["CS1591"]} -->
566569
```csharp
567570
public class Point
568571
{
@@ -598,7 +601,7 @@ where
598601

599602
**Example:**
600603

601-
<!-- Example: {template:"standalone-lib", name:"TagTypeparam", replaceEllipsis:true} -->
604+
<!-- Example: {template:"standalone-lib-without-using", name:"TagTypeparam", replaceEllipsis:true} -->
602605
```csharp
603606
/// <summary>A generic list class.</summary>
604607
/// <typeparam name="T">The type stored by the list.</typeparam>
@@ -622,7 +625,7 @@ where
622625

623626
**Example:**
624627

625-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagTypeparamref", replaceEllipsis:true, expectedErrors:["CS0161"]} -->
628+
<!-- Example: {template:"standalone-lib-without-using", name:"TagTypeparamref", replaceEllipsis:true, expectedErrors:["CS0161"]} -->
626629
```csharp
627630
public class MyClass
628631
{
@@ -631,7 +634,7 @@ public class MyClass
631634
/// <typeparamref name="T"/>.
632635
/// </summary>
633636
/// <param name="string">query to execute</param>
634-
public System.Collections.Generic.List<T> FetchData<T>(string query)
637+
public List<T> FetchData<T>(string query)
635638
{
636639
...
637640
}
@@ -652,18 +655,12 @@ where
652655

653656
**Example:**
654657

655-
<!-- IncompleteExample: {template:"standalone-lib", name:"TagValue", ignoredWarnings:["CS1591"]} -->
658+
<!-- Example: {template:"standalone-lib-without-using", name:"TagValue", ignoredWarnings:["CS1591"]} -->
656659
```csharp
657660
public class Point
658661
{
659-
private int x;
660-
661662
/// <value>Property <c>X</c> represents the point's x-coordinate.</value>
662-
public int X
663-
{
664-
get { return x; }
665-
set { x = value; }
666-
}
663+
public int X { get; set; }
667664
}
668665
```
669666

@@ -711,7 +708,7 @@ The following examples each show a fragment of C\# code, along with the ID stri
711708

712709
**Types** are represented using their fully qualified name, augmented with generic information:
713710

714-
<!-- Example: {template:"standalone-lib", name:"IDStringsTypes", replaceEllipsis:true} -->
711+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsTypes", replaceEllipsis:true} -->
715712
```csharp
716713
enum Color { Red, Blue, Green }
717714

@@ -753,7 +750,7 @@ IDs:
753750

754751
**Fields** are represented by their fully qualified name.
755752

756-
<!-- Example: {template:"standalone-lib", name:"IDStringsFields", ignoredWarnings:["CS0169","CS0649"], additionalFiles:["Acme.cs"]} -->
753+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsFields", ignoredWarnings:["CS0169","CS0649"], additionalFiles:["Acme.cs"]} -->
757754
```csharp
758755
namespace Acme
759756
{
@@ -798,7 +795,7 @@ IDs:
798795

799796
**Constructors**
800797

801-
<!-- Example: {template:"standalone-lib", name:"IDStringsConstructors", replaceEllipsis:true, additionalFiles:["Acme.cs"]} -->
798+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsConstructors", replaceEllipsis:true, additionalFiles:["Acme.cs"]} -->
802799
```csharp
803800
namespace Acme
804801
{
@@ -821,7 +818,7 @@ IDs:
821818

822819
**Finalizers**
823820

824-
<!-- Example: {template:"standalone-lib", name:"IDStringsFinalizers", replaceEllipsis:true, additionalFiles:["Acme.cs"]} -->
821+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsFinalizers", replaceEllipsis:true, additionalFiles:["Acme.cs"]} -->
825822
```csharp
826823
namespace Acme
827824
{
@@ -840,7 +837,7 @@ IDs:
840837

841838
**Methods**
842839

843-
<!-- Example: {template:"standalone-lib", name:"IDStringsMethods", replaceEllipsis:true, customEllipsisReplacements:[null,null,null,"f = 0f;",null,null,null,null,null,null,null,"return null;"], ignoredWarnings:["CS0169","CS0649"], additionalFiles:["Acme.cs"]} -->
840+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsMethods", replaceEllipsis:true, customEllipsisReplacements:[null,null,null,"f = 0f;",null,null,null,null,null,null,null,"return null;"], ignoredWarnings:["CS0169","CS0649"], additionalFiles:["Acme.cs"]} -->
844841
```csharp
845842
namespace Acme
846843
{
@@ -897,7 +894,7 @@ IDs:
897894

898895
**Properties and indexers**
899896

900-
<!-- IncompleteExample: {template:"standalone-lib", name:"IDStringsPropertiesAndIndexers", replaceEllipsis:true} -->
897+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsPropertiesAndIndexers", replaceEllipsis:true, customEllipsisReplacements: ["return default;", "return;","return default;", "return;","return default;", "return;"], additionalFiles:["IProcess.cs"]} -->
901898
```csharp
902899
namespace Acme
903900
{
@@ -920,7 +917,7 @@ IDs:
920917

921918
**Events**
922919

923-
<!-- Example: {template:"standalone-lib", name:"IDStringsEvents", ignoredWarnings:["CS0067"], additionalFiles:["Acme.cs"]} -->
920+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsEvents", ignoredWarnings:["CS0067"], additionalFiles:["Acme.cs"]} -->
924921
```csharp
925922
namespace Acme
926923
{
@@ -939,7 +936,7 @@ IDs:
939936

940937
**Unary operators**
941938

942-
<!-- IncompleteExample: {template:"standalone-lib", name:"IDStringsUnaryOps", replaceEllipsis:true} -->
939+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsUnaryOps", replaceEllipsis:true, customEllipsisReplacements: ["return default;"], additionalFiles:["IProcess.cs"]} -->
943940
```csharp
944941
namespace Acme
945942
{
@@ -960,7 +957,7 @@ The complete set of unary operator function names used is as follows: `op_UnaryP
960957

961958
**Binary operators**
962959

963-
<!-- IncompleteExample: {template:"standalone-lib", name:"IDStringsBinaryOps", replaceEllipsis:true} -->
960+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsBinaryOps", replaceEllipsis:true, customEllipsisReplacements:["return default;"], additionalFiles:["IProcess.cs"]} -->
964961
```csharp
965962
namespace Acme
966963
{
@@ -981,7 +978,7 @@ The complete set of binary operator function names used is as follows: `op_Addit
981978

982979
**Conversion operators** have a trailing “`~`” followed by the return type.
983980

984-
<!-- IncompleteExample: {template:"standalone-lib", name:"IDStringsConversionOps", replaceEllipsis:true} -->
981+
<!-- Example: {template:"standalone-lib-without-using", name:"IDStringsConversionOps", replaceEllipsis:true, customEllipsisReplacements:["return default;","return default;"], additionalFiles:["IProcess.cs"]} -->
985982
```csharp
986983
namespace Acme
987984
{
@@ -1006,7 +1003,7 @@ IDs:
10061003

10071004
The following example shows the source code of a Point class:
10081005

1009-
<!-- Example: {template:"standalone-lib", name:"WholePointClass", replaceEllipsis:true, ignoredWarnings:["CS0659","CS0661","CS0253"]} -->
1006+
<!-- Example: {template:"standalone-lib-without-using", name:"WholePointClass", replaceEllipsis:true, ignoredWarnings:["CS0659","CS0661","CS0253"]} -->
10101007
```csharp
10111008
namespace Graphics
10121009
{
@@ -1015,33 +1012,15 @@ namespace Graphics
10151012
/// </summary>
10161013
public class Point
10171014
{
1018-
/// <summary>
1019-
/// Instance variable <c>x</c> represents the point's x-coordinate.
1020-
/// </summary>
1021-
private int x;
1022-
1023-
/// <summary>
1024-
/// Instance variable <c>y</c> represents the point's y-coordinate.
1025-
/// </summary>
1026-
private int y;
1027-
10281015
/// <value>
10291016
/// Property <c>X</c> represents the point's x-coordinate.
10301017
/// </value>
1031-
public int X
1032-
{
1033-
get { return x; }
1034-
set { x = value; }
1035-
}
1018+
public int X { get; set; }
10361019

10371020
/// <value>
10381021
/// Property <c>Y</c> represents the point's y-coordinate.
10391022
/// </value>
1040-
public int Y
1041-
{
1042-
get { return y; }
1043-
set { y = value; }
1044-
}
1023+
public int Y { get; set; }
10451024

10461025
/// <summary>
10471026
/// This constructor initializes the new Point to (0,0).
@@ -1195,16 +1174,6 @@ Here is the output produced by one documentation generator when given the source
11951174
<summary>Class <c>Point</c> models a point in a two-dimensional
11961175
plane.
11971176
</summary>
1198-
</member>
1199-
<member name="F:Graphics.Point.x">
1200-
<summary>
1201-
Instance variable <c>x</c> represents the point's x-coordinate.
1202-
</summary>
1203-
</member>
1204-
<member name="F:Graphics.Point.y">
1205-
<summary>
1206-
Instance variable <c>y</c> represents the point's y-coordinate.
1207-
</summary>
12081177
</member>
12091178
<member name="M:Graphics.Point.#ctor">
12101179
<summary>This constructor initializes the new Point to (0, 0).</summary>

0 commit comments

Comments
 (0)