views:

227

answers:

5

Is there any way I can get VS2008 to provide further detail on how a particular interface should be implemented?

I'm thinking along the lines of how the /// tags work when using a method. It seems to me that sometimes the method name and params just can't provide enough information about exactly how the interface is meant to work.

Edit

interface MyInterface 
{
    /// <summary>
    /// Returns if the object has a foo
    /// </summary>
    bool HasFoo ();
}

class MyClass : MyInterface
{
    bool HasFoo()  // (Returns if the object has a foo)   <---- Displayed automagicaly from the XML tag in MyInterface
    {
    }
}

hopefully that clears up the question a little bit more

A: 

You can place the xml comments on the signature in the interface and when you cast your class which implements said interface, you will see your xml comments. Otherwise I haven't heard of intellisense which provides information on implementation of an interface.

Yuriy Faktorovich
A: 

Visual Studio won't but MSDN will. The documentation for each interface comes with implementation examples (see IComparable<T> for a good example).

Andrew Hare
+1  A: 

I personally use Resharper - when implementing an interface it gives you the option to copy the XML documentation from the interface which is extremely useful!

Paul Mason
+1  A: 

VS will give tell you which methods you'll need to implement for a given interface.

In VS, right click an interface declaration and select 'Implement Interface' on the popup menu. The menu item will expand out to 'Implement Inferface' and 'Implement Interface Explicitly.'

If you select one of these, then stub methods to implement the selected interface in the manner you selected will be added to your class.

Jay Riggs
It took me a while to find that - however I am referring to having intellisense (or as Paul does with reshaper) show the XML documentation provided in within the interface on the actual implementation
Courtney de Lautour
+2  A: 

The free GhostDoc add-in for Visual Studio will allows you to insert the XML comments from an interface or base class with just a keystroke.

Adam Maras