Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Intellisense on the interface that a method implements if that method does not have its own XML comments

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.

like image 558
Peladao Avatar asked Jan 16 '12 16:01

Peladao


People also ask

What is XML comments in C#?

C# documentation comments use XML elements to define the structure of the output documentation. One consequence of this feature is that you can add any valid XML in your documentation comments. The C# compiler copies these elements into the output XML file.

What is IntelliSense C#?

The IntelliSense completion lists in C# contain tokens from List Members, Complete Word, and more. It provides quick access to: Members of a type or namespace. Variables, commands, and functions names. Code snippets.


1 Answers

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
  }
}
like image 75
brgerner Avatar answered Sep 19 '22 17:09

brgerner