Question

When I refer to a method in my docs, I write something like this: M:MyClass.MyMethod(System.String)

How do I do the same if I need to refer to an extension method?

Was it helpful?

Solution

I believe mjd79 is correct in that you'd refer, or link, to the extension methods using same syntax as for normal methods.

Not sure what tool you are using to compile the docs, but the Sandcastle Help File Builder will automatically find and generate an "Extensions" section for any class that has available extension methods at the time of compile.

I realize this only helpful for documenting extensions for class that you own. When creating extensions for external classes, you do not have many options other than including a blurb in the extension method summary to indicate that the method is intended as an extension method

Attached is a screenshot from some documentation I was playing around with, but you can see the Extensions section: Sandcastle documentation example

OTHER TIPS

Pretty much the same way - remember that extension methods are just static methods in a static class. So, for example, if you have something like this (admittedly useless method):

public class StringExtensions
{
  public static string ToSingleQuotedString(this string s)
  {
    return String.Format("'{0}'", s);
  }
}

Your documentation would look like this: M:StringExtensions.ToSingleQuotedString(System.String)

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top