Question

In Visual Studio 2010 is there a way to get Intellisense on the Interface that a method implements if that method does not have any XML comments of its own?

I suppose something like this would be fairly useful. I like to include XML comments with the interface and don't like to repeat (copy) the same text at every implementing method. Only when something specific to the implementing method needs to be described, I give the method its own XML comments.

Was it helpful?

Solution

If you have ReSharper you can just use Ctrl+Shift+F1 to show the short help of method. If that method does not have any XML comments the help of its interface is shown. I do not have enough reputation to give you a screenshot. So I show you my code and explain it:

internal interface ISomeInterface  
{
  /// <summary>
  /// Integer1 help text by interface.
  /// </summary>
  int Integer1 { get; set; }
}

internal class Class2 : ISomeInterface
{
  public int Integer1 { get; set; }

  public int CallInterface1( )
  {
    return Integer1; // <- Place cursor on Integer1 and press Ctrl+Shift+F1
  }
}

OTHER TIPS

You can do this with Resharper. If you put your cursor on a method declaration that has no XML comment, Rehsarper offers you to automatially copy the comment from the base method.

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