How do I document a c# dll

2019-02-21 18:36发布

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 { }
    }

4条回答
祖国的老花朵
2楼-- · 2019-02-21 19:11

The second should work (summary), be sure to select in the project Properties (Build -> Output ) XML Documentation File.

查看更多
一夜七次
3楼-- · 2019-02-21 19:21

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.

查看更多
男人必须洒脱
4楼-- · 2019-02-21 19:30

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.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-02-21 19:35

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

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

查看更多
登录 后发表回答