问题
I am just checking out F#, so apologies if this is a silly question, but in the VS2008 F# CTP 1.9.6.2 'Tutorial' project, both // and /// are used for commenting code.
Is there a functional difference between the two slash vs three slash commenting, or is it convention (as it appears in the tutorial code) to comment a function with /// and use // for everything else?
回答1:
Using three slashes (///) is a C# convention for XML Documentation Comments that is adopted by F# as well.
回答2:
/// is for documentation comments. VS will use it when generating intellisense information.
回答3:
It's similar to /* comment */
vs /** documented comment */
in Java.
The latter works the same, but is also recognised by documentation software to be developer documentation - not just a note.
回答4:
/// or ''' for C# and VB.Net are much more than internal comments. If one turns on XML documentation file in the project properties one can, then use Sandcastle and HTML Help to generate four different documentation type (files & web sites). See https://github.com/EWSoftware/SHFB/wiki and microsoft docs. Additional, this can be added to your CI process.
来源:https://stackoverflow.com/questions/181015/net-vs-comments-convention