Questions tagged [xml-documentation]

XML documentation is the way to generate automatic documentation from comments inside the code, to an XML formatted file that can be shown with any method, for e.g. a web page.

XML documentation are comments that form the documentation for C# programs. They are so called because they contain nested XML fragments. See Microsoft's XML Documentation Comments (C# Programming Guide) for more details.

391 questions
290
votes
5 answers

How to add a line break in C# .NET documentation

This should be waaaay easier... I want to add a "coded" line break to the XML documentation in my code /// /// Get a human-readable variant of the SQL WHERE statement of the search element. <br/> /// Rather than return SQL, this…
Tinkerer_CardTracker
  • 3,397
  • 3
  • 18
  • 21
248
votes
8 answers

How to reference generic classes and methods in xml documentation

When writing xml documentation you can use something, which works of course. But how do you reference a class or a method with generic types? public class FancyClass { public string FancyMethod(T value) { return…
Svish
  • 152,914
  • 173
  • 462
  • 620
107
votes
5 answers

How can Xml Documentation for Web Api include documentation from beyond the main project?

The documentation for enabling XmlDoc integration into your Web Api projects appears to only handle situations where all of your API types are part of your WebApi project. In particular, it discusses how to reroute the XML documentation to…
Kirk Woll
  • 76,112
  • 22
  • 180
  • 195
106
votes
9 answers

Ways to synchronize interface and implementation comments in C#

Are there automatic ways to sync comments between an interface and its implementation? I'm currently documenting them both and wouldn't like to manually keep them in sync. UPDATE: Consider this code: interface IFoo{ /// ///…
Valentin V
  • 24,971
  • 33
  • 103
  • 152
80
votes
1 answer

How do I reference a C# keyword in XML documentation?

, for example, doesn't work - I get the compilation warning: XML comment on ... has syntactically incorrect cref attribute 'switch' Context for those who are interested... /// Provides base functionality for hand-coded…
Daniel Schaffer
  • 56,753
  • 31
  • 116
  • 165
66
votes
2 answers

Which C# XML documentation comment tag is used for 'true', 'false' and 'null'?

Which C# XML documentation comment tag is used for the literals true, false and null? In Microsoft's own documentation, these literals appear in bold text. For example, the documentation for the property ArrayList.IsFixedSize appears as: true if…
DavidRR
  • 18,291
  • 25
  • 109
  • 191
61
votes
8 answers

XML-documentation for a namespace

Would you write xml-doc for a namespace? And if yes, how and where? I would think, if it is possible, maybe an almost empty file like this: /// /// This namespace contains stuff /// namespace Some.Namespace { } But will that…
Svish
  • 152,914
  • 173
  • 462
  • 620
58
votes
4 answers

Summary is not showing in the assembly if it is added as a reference

I've created a 'Class Library' in C#, which has many functions with summary (XML documentation comments). For example /// ///Adds the two numbres /// public void Add() { //statements } if i use the function in the same…
Thorin Oakenshield
  • 14,232
  • 33
  • 106
  • 146
47
votes
1 answer

What rules are applied to SHFB's IntelliSenseComponent's output folder?

Noda Time has an issue against it that the XML documentation file it ships contains all the internal and private members too - which is a shame. Fortunately, Sandcastle Help File Builder has a custom build component - IntelliSenseComponent - which…
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
47
votes
7 answers

Referring to a generic type of a generic type in C# XML documentation?

Writing some XML documentation for a predicate helper class. But I can't figure out I can refer to an Expression> without getting a syntax error. Is it even possible? I have tried this: But I…
Svish
  • 152,914
  • 173
  • 462
  • 620
46
votes
2 answers

How to generate XML documentation for CSPROJ with multiple targets

I have a library project that has multiple targets, e.g. in the CSPROJ file it has: net40;net46;net461;net462;net47 If I want XML documentation for all combinations of these target frameworks and Debug and…
Ian Mercer
  • 38,490
  • 8
  • 97
  • 133
46
votes
1 answer

How do you get XML comments to appear in a different project (dll)?

/// /// This method does something... /// public void DoSomething() { // code... } When using that method/class etc... in a different .dll the comments do not show up.
Finglas
  • 15,518
  • 10
  • 56
  • 89
42
votes
2 answers

What's the proper way to comment a constructor in a generic class?

What's the proper way to comment this? /// /// Initializes a new instance of the class. /// /// The unit of work. public Repository(IUnitOfWork unitOfWork) { …
mservidio
  • 12,817
  • 9
  • 58
  • 84
38
votes
3 answers

Rendering constants into XML documentation?

I have 2 private consts and a public method: private const byte _minAge = 24; private const byte _maxAge = 29; public bool IsInAgeRange() { ... } I am adding XML documentation, and would like it best if the users of my code could read this in…
tsemer
  • 2,959
  • 3
  • 29
  • 26
33
votes
1 answer

How do I reference method parameters in a method summary when writing XML documentation?

Suppose I have a method as follows: /// /// Here I want to reference the parameter . /// /// /// The person id. /// /// /// The…
user2078938
  • 947
  • 1
  • 9
  • 22
1
2 3
26 27