Questions tagged [xml-comments]

Can refer to 1) comments in XML documents or 2) XML markup used for documentation in programming language comments.

A comment in an XML document looks like this:

<!-- comment text -->

See https://www.w3.org/TR/xml/#sec-comments.


For information on the second meaning of this tag, see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/.

See also https://blog.submain.com/using-xml-comments/.

315 questions
12
votes
3 answers

Visual Studio 2015 missing XML comments / documentation

Is it me or are the XML comments missing for System.Linq in Visual Studio 2015? Because I can still find it on MSDN. But when typing, for example, this code: var list = new List(); list.Select( IntelliSense doesn't provide the…
QuantumHive
  • 5,613
  • 4
  • 33
  • 55
11
votes
3 answers

Visual Studio - Summary Tag Comments - Optional Params

When specifying summary tag comments, is there a way with the tag to note that a parameter is optional, ie. the client can supply a value or null, such as: . Googling has failed to provide me with a set…
cweston
  • 11,297
  • 19
  • 82
  • 107
10
votes
4 answers

How do I customize the auto commenting text in Visual Studio?

When I type the trigger the auto comment feature in Visual Studio (by typing "'''" or "///"), most of the XML commenting details show up that I like. However, I typically add the history tag to the documentation so I can track and changes that are…
Dillie-O
  • 29,277
  • 14
  • 101
  • 140
10
votes
2 answers

How/under which circumstances does the tag in Delphi xml comments actually work?

I wonder how these XML references work, I'm just not getting why they work or why they don't work and I found nothing about that. Here's an example: type TOuterClass= class strict private type TLogger = class public ///…
RSE
  • 322
  • 1
  • 10
10
votes
1 answer

What are the supported character entities for XML comments?

In the following example, & and Δ are OK but Δ is not (the latter two are both Δ). The compiler issues a warning similar to: warning CS1570: XML comment on 'XXX.DocumentedMethod()' has badly formed XML -- 'Reference to undefined…
jrummell
  • 42,637
  • 17
  • 112
  • 171
10
votes
4 answers

How to place the code example in the XML comment?

I have a XML comment like that. /// /// Lorem ipsum /// /// /// I'd like to place inside it a piece of the (multiline) code. How can I do that ? Edit Here's the info about…
Tony
  • 12,405
  • 36
  • 126
  • 226
9
votes
1 answer

Why I can't see xml comments from external library?

Is it normal I can't see xml comments from external libraries? For example I have an external library with xml comments on methods. After making a reference to this library I was hoping that xml comments appears when I make usage of the external…
bAN
  • 13,375
  • 16
  • 60
  • 93
9
votes
1 answer

XML Comments - How to comment multiple reasons for an exception?

Here's an example: public void DoSomething(String param1, String param2) { if (param1 == null) throw new ArgumentNullException("param1"); if (param2 == null) throw new ArgumentNullException("param2"); } 2 different reasons for an…
myermian
  • 31,823
  • 24
  • 123
  • 215
9
votes
2 answers

c# xml comment, cref can't reference method defined in base class

In my codebase I have a method defined in a base class, the base class is inherited, but the method is not yet overridden. This method will very likely be overridden in the future to add to the base implementation. My setup looks a bit like…
Rob
  • 2,466
  • 3
  • 22
  • 40
9
votes
2 answers

Use property XML comments as parameter descriptions in Swagger

I created a Web API using ASP.NET Core and used swagger to create documentation. I use the XML comments on my API endpoints to provide additional information in the documentation. The swagger configuration is: services.AddSwaggerGen(c => { …
devC
  • 1,384
  • 5
  • 32
  • 56
9
votes
2 answers

Add XML Comments to class properties generated by the LINQ to SQL designer

I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next time the dbml file is…
NakedBrunch
  • 48,713
  • 13
  • 73
  • 98
9
votes
6 answers

What are the virtues of using XML comments in .NET?

I can't understand the virtues of using XML comments. I know they can be converted into nice documentation external to the code, but the same can be achieved with the much more concise DOxygen syntax. In my opinion the XML comments are wrong,…
Michal Czardybon
  • 2,795
  • 4
  • 28
  • 40
9
votes
1 answer

How to explicitly document that a method does not throw exceptions

Using XML comments in C#, I can document that a method may throw an exception: Thrown if foo is invalid. However, if a method has no exception tag in its XML documentation, this may mean one of two…
Daniel Wolf
  • 12,855
  • 13
  • 54
  • 80
9
votes
9 answers

Code Commenting: Do you put your code comments on Interfaces or on Concrete classes, or both?

What is the best practice in documenting classes and interfaces. Say if you have a concrete class called Foo, that derives from an interface called IFoo. Where do you put your comments for your methods? Do you duplicate your comments on the…
7wp
  • 12,505
  • 20
  • 77
  • 103
9
votes
2 answers

XML comments for properties / accessors

Is it possible to add XML comments for set and get accessors which will be visible in Object Browser (VS 2010)? /// /// Something about property. /// public bool IsSomething { // get description get { …
apocalypse
  • 5,764
  • 9
  • 47
  • 95
1 2
3
20 21