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.

363 questions
218
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
  • 2,677
  • 3
  • 16
  • 21
211
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
  • 138,188
  • 158
  • 423
  • 589
102
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
  • 70,584
  • 19
  • 171
  • 185
98
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
  • 22,569
  • 28
  • 97
  • 147
65
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
  • 52,912
  • 28
  • 108
  • 161
54
votes
7 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
  • 138,188
  • 158
  • 423
  • 589
52
votes
3 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
  • 12,814
  • 30
  • 97
  • 141
47
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
  • 15,000
  • 17
  • 89
  • 169
45
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,261,211
  • 792
  • 8,724
  • 8,929
44
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,050
  • 9
  • 51
  • 85
42
votes
6 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
  • 138,188
  • 158
  • 423
  • 589
36
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
  • 11,994
  • 8
  • 52
  • 82
32
votes
2 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,580
  • 2
  • 25
  • 24
31
votes
4 answers

auto-document exceptions on methods in C#/.NET

I would like some tool, preferably one that plugs into VS 2008/2010, that will go through my methods and add XML comments about the possible exceptions they can throw. I don't want the or other XML tags to be generated for me because I'll…
Sarah Vessels
  • 27,994
  • 29
  • 147
  • 217
30
votes
3 answers

Show xml tag into visual studio intellisense

I added the xml tag to some of my methods but I can't see its content in IntelliSense. Here is my code: /// /// we all live in a yellow summary /// /// what it returns public int MyMethod() { ....…
1
2 3
24 25