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
9
votes
1 answer

Can I change the XML comment template in Visual Studio?

I would like to add a or two to the "standard" template of XML comment tags provided by Visual Studio 2010. When I type /// in my source, I'd like to see the new tags included with the default tags in the inserted comment block. How do I do…
Walter Kelt
  • 2,199
  • 1
  • 18
  • 22
8
votes
2 answers

How to specify the Type in an XML Comment comment

In my C# XML Comment's comment, I would like the output (I'm using Sandcastle) to specify the Type that is returned, but I am unable to find out how to do that. Psuedo Example: /// ///Serves as a hash function for a particular…
Jed
  • 10,649
  • 19
  • 81
  • 125
8
votes
1 answer

XML Comments not appearing in WCF Service

I have a WCF service and commenting my operation contracts as below: /// /// Call to topup a card. /// /// The TopUp object which specifies the card to topup. /// Returns…
David
  • 113
  • 1
  • 3
8
votes
14 answers

Code documentation: How much is too much?

How much code documentation in your .NET source is too much? Some background: I inherited a large codebase that I've talked about in some of the other questions I've posted here on SO. One of the "features" of this codebase is a God Class, a single…
Robert S.
  • 25,266
  • 14
  • 84
  • 116
8
votes
4 answers

Finding missing XML comments content with Visual Studio

Throughout or C# sourcecode we have a lot of comments that miss the actual content such like this: /// /// or this: /// /// /// or this: /// Unfortunately Visual Studio does…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
8
votes
1 answer

Convert Doxygen to XML comments

We have a C# project which for historical reasons uses both Doxygen and Visual Studio style comments in the same code. Has anyone tried to systematically translate one standard to another, preferably to the common XML subset? I guess it would not…
jmster
  • 943
  • 1
  • 12
  • 25
8
votes
1 answer

How to refer to an extension method of a generic class in XML comments

What is the proper XML-comment syntax to refer to the SingleOrDefault extension method on the IEnumerable interface? My latest attempt is: The warning is: XML comment on 'yourMethod' has cref…
harley.333
  • 3,696
  • 2
  • 26
  • 31
8
votes
3 answers

C# XML Comment Reuse

I'm writing a C# class library with a number of classes with functions that do just about the same stuff. I need to provide XML comments about the function arguments in each class which are very detailed but the same in most cases. Is there a way…
Ryan Renne
  • 91
  • 5
8
votes
2 answers

Do xml comments persist in release mode?

On the one hand MSDN says: The XML doc comments are not metadata; they are not included in the compiled assembly ... But on the other hand, Intellisense shows them in Visual Studio for .net classes etc. (e.g. if you hover over Int32.) To avoid…
ispiro
  • 26,556
  • 38
  • 136
  • 291
7
votes
1 answer

Reference generic comment

I was wondering if it is possible to reference a dynamic generic class name in a comment and have it conditionally resolved in the IDE? Simple base class example: // // Retrieves all members from the database. // public void…
Alex
  • 75,813
  • 86
  • 255
  • 348
7
votes
1 answer

Visual Studio 2010 SDK -- How to place an adornment next to XML comment groups?

I'm having trouble finding out how to do this and the Visual Studio SDK Reference is not very helpful either. I'm trying to figure out how to get a NormalizedSnapshotSpanCollection of XML comments. I want to place an icon next to them... I don't…
michael
  • 14,844
  • 28
  • 89
  • 177
7
votes
1 answer

How to specify language in xml comment tag

Is there a way to specify what language is being used in the tag used within an tag in XML comments? I am using Sandcastle Help File Builder to test building documentation from my XML comments, but when I include VB.net code samples…
Amanda Kitson
  • 5,477
  • 12
  • 49
  • 73
7
votes
1 answer

Is there any way to preserve white space in C# XML comments?

I'm currently documenting my C# code and would find it useful to include a code block that directly shows how a piece of code should be called. I use the tag that is embedded into the summary: While this works in general, I would like to…
feO2x
  • 5,358
  • 2
  • 37
  • 46
7
votes
2 answers

XML Comments -- How do you comment explicitly implemented interfaces properly?

Code: public interface IFoo { void Bar(); } public class FooClass : IFoo { /// ... /// //How do you reference the IFoo.Bar() method public void Bar() { } /// ...
myermian
  • 31,823
  • 24
  • 123
  • 215
7
votes
4 answers

c# xml code comment for file reference

Is there a tag for a file reference in a xml code comment? The file is a sql script file. Just wondering if there is a better way than something like this /// ///please have a look at c:\code\project1\sql\file1.sql ///
JML
  • 382
  • 7
  • 18