Is there a standard (like phpdoc or python's docstring) for commenting C# code?

前端 未结 6 1602
遇见更好的自我
遇见更好的自我 2021-01-03 20:12

Is there a standard convention (like phpdoc or python\'s docstring) for commenting C# code so that class documentation can be automatically generated from the source code?

6条回答
  •  隐瞒了意图╮
    2021-01-03 20:43

    You can use XML style comments, and use tools to pull those comments out into API documentation.

    Here is an example of the comment style:

    /// 
    /// Authenticates a user based on a username and password.
    /// 
    /// The username.
    /// The password.
    /// 
    /// True, if authentication is successful, otherwise False.
    /// 
    /// 
    /// For use with local systems
    /// 
    public override bool Authenticate(string username, string password)
    

    Some items to facilitate this are:

    GhostDoc, which give a single shortcut key to automatically generate comments for a class or method. Sandcastle, which generates MSDN style documentation from XML comments.

提交回复
热议问题