Can C # files contain file level summary comments?

eg.

Foo.cs:

using System; /// <summary> /// This file contains Foo and Bar-related things. /// </summary> namespace Xyz { class FooThing { } } 

Does C # support such XMLDoc comments?

+4
source share
3 answers

No, XML document comments can only be displayed for certain types of elements, as described in this article :

In source files, documentation comments preceding the following can be processed and added to the XML file:

User types such as class, delegate, or interface

Members such as a field, event, property, or method

If you place a file-level XMLDoc-style comment in your file, it will be added to the next class or other element that appears. Some documentation tools, such as Sandcastle, provide a way to add XMLDoc comments at the space level, but they usually appear in a separate file.

Of course, you can use XMLDoc style comments in every file, for example. copyright header or similar, simply using the standard / * * / style comment blocks.

+7
source

According to the / doc documentation , no, this is not supported.

In source files, documentation comments preceding the following can be processed and added to the XML file:

  • User types such as class, delegate, or interface

  • Members such as a field, event, property, or method

+4
source

Yes, you can. I think this link might help:

Documentation and comment for C #

C # and Visual Studio.NET (VS.NET) give us the ability to maintain code and documentation in the same file. VS.NET does this by taking specially marked and structured comments from code and creating them into an XML file. This XML file can then be used to generate readable documentation in various forms, including web pages, MSDN-style documentation, and Intellisense in a code window.

In the link you will find detailed information on how to do this ...

0
source

Source: https://habr.com/ru/post/1414456/


All Articles