简体   繁体   中英

How do I document a c# dll

How do I write a class so that property and method descriptions are visible to people referencing the dll in other projects?

    [Description("My age in years attribute")]
    public int Age
    {
        get { return 0; }
        set { }
    }

doesn't work, neither does

    /// <summary>
    /// My age in years attribute
    /// </summary>
    public int Age
    {
        get { return 0; }
        set { }
    }

In Visual Studio:

Project -> Properties -> Build -> Check "XML Documentation File".

For further details, see XML Comments Let You Build Documentation Directly From Your Visual Studio .NET Source Files .

The description provided in DescriptionAttribute is visible in Property Grid for sure and it has nothing to do with code editor.

For XML comments to be available, you have to generate an XML documentation file and ship it with your assembly.

Did you build the XML documentation file for your second case?

Project properties -> Build -> [Output] XML Documentation file

第二个应该工作(摘要),请确保在项目的Properties(构建-> Output)中选择XML Documentation File。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM