Using NamespaceDoc and NamespaceGroupDoc Classes

If your build tool supports it, namespace comments can also be specified and maintained in your source code by adding an empty NamespaceDoc class to each namespace. When comments for this class are found in the XML comments files they will be used as the namespace comments.

To keep the NamespaceDoc class from appearing in the help file, leave off the public keyword and mark it with a CompilerGenerated attribute. This will cause the class to be automatically ignored when reflection information is generated for the assembly. The following is an example:

C#
namespace Company.Product.Widgets
{
    /// <summary>
    /// These are the namespace comments for <c>Company.Product.Widgets</c>.
    /// </summary>
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    class NamespaceDoc
    {
    }
}

If the project has namespace grouping enabled, you can also maintain the namespace group comments using a NamespaceGroupDoc class in a similar fashion. The following is an example:

C#
namespace Company.Product
{
    /// <summary>
    /// These are the group comments for namespaces in <c>Company.Product</c>.
    /// </summary>
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    class NamespaceGroupDoc
    {
    }
}

See Also