Search code examples
c#namespacesxml-documentation

XML-documentation for a namespace


Would you write xml-doc for a namespace? And if yes, how and where?

I would think, if it is possible, maybe an almost empty file like this:

/// <summary>
/// This namespace contains stuff
/// </summary>
namespace Some.Namespace
{

}

But will that work? Since you... "declare", or at least use the namespace in all the other files as well... and what would happen if you wrote an xml-documentation thing somewhere else on the same namespace? Would one be gone? Or would they be merged somehow?


Solution

  • NDoc supports this by recognising a special NamespaceDoc class located in each namespace, and using the documentation from that. I haven't tried it, but Sandcastle appears to support the same trick.

    Edit: For example:

    namespace Some.Namespace
    {
        /// <summary>
        /// This namespace contains stuff
        /// </summary>
        public static class NamespaceDoc
        {
        }
    }