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 misunderstandings: I'm referring to these:
/// <summary>
/// These comments.
/// </summary>
void example()
{
//Not these.
}
XML comments help speed development by providing IntelliSense on custom methods and other code constructs.
The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags. There's IntelliSense support for writing documentation comments that also provides a template comment on entering the third slash in the triple slash.
Syntax. An XML comment should be written as: <! -- Write your comment-->
The use of XML doc comments requires delimiters that indicate where a documentation comment begins and ends. You use the following delimiters with the XML documentation tags: /// Single-line delimiter: The documentation examples and C# project templates use this form.
The XML documentation files are separate from the DLLs for an assembly. They are just UTF8 XML Files. If they happen to be in the same folder as the DLL that they document, then Visual Studio will pick them up.
When you compile, the build process will copy the XML files into the build output folder automatically, if they exist.
None of the contents of the XML documentation ever gets put inside any DLL.
If you look at the framework DLL files (for example in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0") you will see loads of ".xml" files next to them.
No these are stripped when you compile your code to IL....Compile your code to a DLL or exe and then use the tool ILDasm to open it. You will notice you comments are not included. You could then decompile your code with a tool like Reflector and again see your comments are gone. ILDasm and Reflector are great tools in general you should become familiar with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With