3

In VisualStudio (InteliSense): How can I make the description of an interface method (property or what ever) on mouse over "visible" for the interface implementation, if the typedef for an object of the interface implementation is not the interface declaration (for example var or in this case InterfaceImplementation)?

Example:

public interface Interface
{
    /// <summary>
    /// Description I like to write just once,
    /// but like to have it "visible" in each implementation.
    /// </summary>
    void Method();
}

public class InterfaceImplementation : Interface
{
    public void Method() { /* method impl without description */ }
}

class Program
{
    static void Main( string[] args )
    {
        // on mouse over interfaceImplementation.Method() I can not see the Interface.Method description. 
        InterfaceImplementation interfaceImplementation = new InterfaceImplementation();
        interfaceImplementation.Method();

        // on mouse over varInterfaceImplementation.Method() I can not see the Interface.Method description. 
        var varInterfaceImplementation = new InterfaceImplementation();
        varInterfaceImplementation.Method();

        // only on mouse over interfaceRepresentation.Method() I can see the Interface.Method description. 
        Interface interfaceRepresentation = new InterfaceImplementation();
        interfaceRepresentation.Method();
    }
}
Monotomy
  • 554
  • 1
  • 6
  • 24
  • You can't - the tooltips are sourced from whatever the compile time type of your variable is. If you declare your variable as an `Interface` you'll get the interface comments, whereas if you declare it as an `InterfaceImplementation`, you'll get the implementation comments. – RB. Oct 26 '16 at 11:12
  • @Liam: yes, thanks. seems the solution, but its broken in VS :-/ – Monotomy Oct 26 '16 at 11:12
  • If you like, please make pressure and vote for the bug fix: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3745102-add-intellisense-support-for-the-inheritdoc-ta – Monotomy Oct 26 '16 at 11:22

0 Answers0