views:

89

answers:

2

Hello,

I was wondering if anyone knows how to link an interface xml comment to an implementation. The problem is that I want the base comments to come from my interface first. Example:

interface myinterface {

       /// <summary>
       /// Does something.
       /// </summary>
       void method1(string foo);

}

and then the implementation is:

public class myclass : myinterface {


       public void method1(string foo) {
             //do something...
       }
}

So now if I hover over the method with my mouse after instantiating the object:

myclass foo = new myclass();
foo.method1("do something");

how can I make the comments appear in the hover popup? Is there some way I can link the interface comments to the implementation? I know there's a way in Java, but can't find the solution for C#.

Thanks

+8  A: 

Linking XML Comments is IMHO not possible, but you could use a tool like GhostDoc to copy the XML Comment from your Interface/Baseclass to the implementation/derived class.

Noffls
Yes, use GhostDoc; it will first see if a parent class or method is overridden and copy the comment if so. ReSharper will also copy xml-doc comments in the more limited scope of extracting new superclasses/interfaces, or pushing members up/down in a hierarchy.
KeithS
+3  A: 

If you use GhostDoc it helps a lot with "transporting" the documentation from interfaces to the implementing code.

Fredrik Mörk