25

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?

Mike B
  • 12,768
  • 20
  • 83
  • 109
johnc
  • 39,385
  • 37
  • 101
  • 139

4 Answers4

44

Using three slashes (///) is a C# convention for XML Documentation Comments that is adopted by F# as well.

Kols
  • 3,641
  • 2
  • 34
  • 42
Franci Penov
  • 74,861
  • 18
  • 132
  • 169
11

/// is for documentation comments. VS will use it when generating intellisense information.

Alexander Kojevnikov
  • 17,580
  • 5
  • 49
  • 46
7

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.

Dean Rather
  • 31,756
  • 15
  • 66
  • 72
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.

Phil Huhn
  • 3,307
  • 3
  • 18
  • 35