Which C# XML documentation comment tag is used for 'true', 'false' and 'null'? [duplicate]
Asked Answered
L

2

70

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 the ArrayList has a fixed size; otherwise, false. The default is false.

None of Microsoft's Recommended Tags seem to apply to this situation. The best fit appears to be <c>, however <c>true</c> appears as true when the documentation is rendered by Doxygen.

However, using <b>true</b> with Doxygen yielded bold text as I surmised that it might. But that leaves me wondering about the portability of using standard HTML tags with other documentation generation tools such as Sandcastle and GhostDoc.

Lamella answered 23/1, 2014 at 21:3 Comment(3)
I am using the <c> for all the boolean and its what is the standard that we follow to represent the bool values in the comments.Cogency
You can also use e.g. <see langword="true">. But it's not in bold text for me (I use Sandcastle), the font is in blue instead.Monday
@Monday you forgot /: <see langword="true"/>Inharmonic
H
87

You should use the <see langword="true"/> entry so that it works right for whatever language is being used.

Hyoscyamine answered 17/9, 2018 at 20:46 Comment(1)
In Microsoft's updated documentation on the page Recommended XML tags for C# documentation comments, see the topic Generate links and references which states for see: langword="keyword": A language keyword, such as true or one of the other valid keywords.Lamella
V
19

Per GhostDoc's behavior, <c>true</c> is the correct answer. I've voted up saravanan's comment now that I've been able to confirm it.

Vilmavim answered 11/12, 2014 at 20:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.