How to show general notes about function overloads

I created a function with some overloads. Now I want to add comments for each overload, but not repeat the summary content again and again. I only need to provide a description of the parameter.

i.e.

    /// <summary>
    /// Binds Control With DataTable/DataSet Passed as a Parameter. DataTable/Control Should not be NULL.
    /// </summary>
    /// <param name="lbx">DropDownList control</param>
    /// <param name="dt">Object of DataTable from where value need be fetched.</param>
    /// <param name="displayMember">Display Member for the list</param>
    public static void Source(this DropDownList ddl, DataTable dt, string displayMember)
    {
     // do something.
    }

    /// <summary>
    /// Binds Control With DataTable/DataSet Passed as a Parameter. DataTable/Control  
    /// </summary>
    /// <param name="lbx">DropDownList  control</param>
    /// <param name="dt">Object of DataTable from where value need be fetched.</param>
    /// <param name="displayMember">Display Member for the list</param>
    /// <param name="_setDefaultItem">If True Sets the default value as -1 and corresponding string</param>
    public static void Source(this DropDownList ddl, DataTable dt, string displayMember, bool _setDefaultItem)
    {
     //do something
    }

Here I do not want to write a summary section again and again, but I want to write comments about only part of the parameter. Rest should be visible for each overload.

Is there any way to do this?

+3
source share
1 answer

You can use include to achieve this.

Create an xml file with a general summary, parameter descriptions of your overloaded methods.

.

/// <include file='common_tag.doc' path='MyDocs/MyMembers[@name="source"]/*' />
public static void Source(this DropDownList ddl, DataTable dt, string displayMember) 
{ 
 // do something. 
} 

/// <include file='common_tag.doc' path='MyDocs/MyMembers[@name="source"]/*' />
/// <param name="_setDefaultItem">If True Sets the default value as -1 and corresponding string</param> 
public static void Source(this DropDownList ddl, DataTable dt, string displayMember, bool _setDefaultItem) 
{ 
 //do something 
} 

ur xml

<MyDocs>

<MyMembers name="source">
<summary>
Binds Control With DataTable/DataSet Passed as a Parameter. DataTable/Control Should not be NULL
</summary>
<param>....</param>
</MyMembers>


</MyDocs>

...

+1

Source: https://habr.com/ru/post/1754976/


All Articles