Halcyon
Halcyon

Reputation: 14971

Is There A Way To Display Intellisence Comments On Implemented Interface Methods?

This is a question about XML comments in Visual Studio.

I have a class that implements an interface. When I place XML comments on the methods that implement the interface, the XML comments in intellisence use the methods from the interface and not the implemented methods. If I remove the comments from the interface methods, intellisence doesn't show any comments. Is there some way to get intellisence to use the comments from the implemented methods instead of the interface methods?

Upvotes: 2

Views: 76

Answers (1)

Sergey Berezovskiy
Sergey Berezovskiy

Reputation: 236208

No, there is no way. You should have variable of implementor type to see comments from implemented members.

Consider following. You have interface

public interface IAnimal
{
    /// <summary>
    /// Returns animal weight
    /// </summary>
    int Weight { get; }
}

And you have two implementors - Dog and Cat. Each has it's own comments for Weight property. And you have factory method which returns IAnimal instance based on some conditions (i.e. stars in sky)

 IAnimal animal = GetAnimal();

What do you expect to see on animal.Weight? Comments of dog or cat's comments?

Upvotes: 3

Related Questions