Documenting overloaded methods with the same XML comments

前端 未结 4 1942
情书的邮戳
情书的邮戳 2021-02-02 08:16

Say I have this constructor:

/// 
/// Example comment.
/// 
public SftpConnection(string host, string username, 
    string passwo         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 08:30

    I came from google and I'd like to share my solution based on the discussion above.

    Let's assume that you have two methods, one of them is an overload:

    public void MethodA(string paramA);
    public void MethodA(string paramA, string paramB);
    

    in order to map them to a XML file documentation you'd need to use the following commments:

    /// 
    public void MethodA(string paramA);
    
    /// 
    public void MethodA(string paramA, string paramB);
    

    And inside of your XML file, you need to use the tag as informed by @Kache, the only thing which is important to note is the hierarchical structure which needs to be respected, so the final solution would be like this:

    in the MyXMLFile.xml

    
    
          
           My MethodA...  
          
          
            My ParamA....
          
    
    
          
           My MethodA...  
          
          
            My ParamA....
          
          
            My ParamB....
          
    
    
    

提交回复
热议问题