Say I have this constructor:
/// <summary>
/// Example comment.
/// </summary>
public SftpConnection(string host, string username,
string password, int port) {...}
which has these overloads:
public SftpConnection(string host, string username, string password)
: this(host, username, password, 22) { }
public SftpConnection(string host, string username, int port)
: this(host, username, "", port) { }
public SftpConnection(string host, string username)
: this(host, username, "", 22) { }
and in reality, the XML comment is pretty large, with param
, example
and exception
elements and so on.
Is there some way to add a special XML comment one-liner to the overloads, such that they use the exact same comments so that I don't need to copy-paste the whole, enormous original comments?
I'm thinking something like: <use cref="SftpConnection(string,string,string,int)" />
which doesn't work of course.
I am aware of the include
element, but I get the impression it reads the comments from an XML file instead, which I don't want - I want the comment to still be visible in the code, but only once.
Thanks :-)
UPDATE: For those who ask this question in future: After some digging, I've learned that the functionality that I wanted simply does not exist. However some good alternatives might be:
- Consolidating your overloads (see Timwi's answer)
- Linking to your original comment using the
see
element - Using the
include
element to save your duplicated comments in an XML file and pasting them once, for only one of your overloads.