Search code examples
c#methodsoverloadingsummaryxml-documentation

C#, How to make overload methods share <summary> tag


I'm developing a small class, with my overload methods, like following:

/// <summary>
/// some description about myMethod
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
/// <returns></returns>
public string myMethod(string arg1, string arg2) { };
public string myMethod(string arg1){};

The problem is that the method which take one argument does not show the description in tag. Should I separately add the same summary tag to the second method? I think it is a little annoying, because the myMethod description should has the same tag description, although the parameter description can vary.

Is there a way to make overload methods share one description?


Solution

  • Even though the method names are same, but they can have different implementation and can do different things. Hence you need to provide separate summary for each of them.