0

Is it possible to update or populate the comment (XML Documentation) on an interface method based on its implementation?

I.e. generate a comment on the method and then mark the method of the interface with it?

Internet seems to suggest that there was a similar feature available under Alt+Enter but the answers are 6 years old and don't seem to work anymore.

Can I propagate XML documentation from an interface to its implementation?

The other suggestion is for <inheritdoc/> tag which seems to be a different thing

Bartosz
  • 4,406
  • 7
  • 41
  • 80
  • It seems counterintuitive to base the comment on an interface method based on that method's implementation. I hope you're writing your consuming code according to the interface and not any implementation? – MarioDS Jul 16 '17 at 18:19
  • In some situations you want to add more info to the comment when you are working on the implementation of the method. Method name might be intuitive but in some cases you might want to add more info. Also, in some cases you only have and intend to have one and only implementation of the interface - and you use the interface for this class for unit testability or DI reasons, not really because of the possibility of multiple different forms of the interface. – Bartosz Jul 16 '17 at 19:11
  • So what's wrong about having all the documentation on the interface then? – Matthias Jul 18 '17 at 03:16
  • @Matthias Not much, but I wonder whether its possible to update /generate it while being 'in' the implementation method, without jumping to the interface. Resharper tends to be helpful in avoiding such jumps. – Bartosz Jul 18 '17 at 06:38
  • No it doesn't. Best you can do is putting the caret onto the method declaration, and use 'Goto Base' to navigate quickly to the interface declaration. – Matthias Jul 18 '17 at 13:57
  • @Matthias - if you are sure about this, then this should be an answer, don't you think? – Bartosz Jul 18 '17 at 15:14
  • 1
    Yes I'm pretty sure... I wrote `` support in ReSharper :) – Matthias Jul 18 '17 at 18:15
  • But let's keep this question open, since *no* is not really an answer... Maybe something like this is going to be implemented later. No one knows :) Next time, I suggest you to use our own issue tracker (https://youtrack.jetbrains.com), because it's very much product related. – Matthias Jul 18 '17 at 18:17

0 Answers0