1

I was coding in java for a very long time and got used to it's Docstring format. I was wondering if I could use the exact same format for C# code.

Assuming i got this code:

/**
 * Takes in two integers and multiplies them
 * @param a First factor
 * @param b Second factor
 * @return Product of both factors
*/
int multiply(int a, int b){
    return a*b;
}

If this is actually legit, how can i configure Visual studio

to autocomplete the Docstring, when i type /** + Enter ?

Thanks in advance :D

Alan
  • 949
  • 8
  • 26
  • by not using `/**`, but simply `///`. See https://learn.microsoft.com/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments – MakePeaceGreatAgain Jan 03 '19 at 11:40
  • Alright. But is there no way to "choose" to use /** as that "html" format looks very unaesthetically to me :S – Alan Jan 03 '19 at 11:44
  • I doubt there is, as this "unaesthetical" docs is exactly the syntax used for all .NET docs. It is intended to be exported to an xml-file which than can be used by external tools such as Sandcastle in order to create HTML or whatever helpfile. – MakePeaceGreatAgain Jan 03 '19 at 11:46
  • Ok fair enough. I'd like to mention, that Visual Studio actually highlights /** differently than /*, so I assumed that there was a way to use /** – Alan Jan 03 '19 at 11:48
  • 1
    Just as you shouldn't copy Java naming conventions into C#, you should also recognise that it uses other conventions for the same *purposes* (such as documentation) – Damien_The_Unbeliever Jan 03 '19 at 11:48
  • By just typing "c# docstring" into google I've got [this](https://stackoverflow.com/q/34516/1997232) as first result. Isn't it the same for you? – Sinatr Jan 03 '19 at 12:13

1 Answers1

2

In visual studio, you type /// to trigger that functionality.

bizzehdee
  • 20,289
  • 11
  • 46
  • 76