.NET // vs /// Comments convention

筅森魡賤 提交于 2019-12-05 10:54:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!