How to add description to functions and function parameters?

后端 未结 5 840
轻奢々
轻奢々 2021-02-03 18:23

I\'m writing a VB.NET function with a ton of overloads. I\'ve seen that most .NET functions have parameter descriptions in IntelliSense. For example, when typing in String

相关标签:
5条回答
  • 2021-02-03 18:38

    For the parameters...

    ''' <summary>
    ''' Procedure description
    ''' </summary>
    ''' <param name="someVariable">someVariable description.</param>
    ''' <param name="someVariable">someVariable description.</param>
    ''' <remarks></remarks>
    
    0 讨论(0)
  • 2021-02-03 18:42

    Place the cursor on the line before the method and type three apostrophes ('''). You will get a template for writing XML documentation for the method and it's parameters.

    0 讨论(0)
  • 2021-02-03 18:44

    Use xml comments. There are some predefined tags that load into intellisense after you compile. and the wonderful thing is, if you place your cursor on the line above your function, then press ''' (triple-single quote, if that makes sense) and enter, it will prefill a bunch of stuff for you. Heres an article:

    Documenting Your Code with XML Comments

    0 讨论(0)
  • 2021-02-03 18:48

    Right click a method/member name and choose 'Insert Comment' from the context menu.

    The contents of the XML for the member/method will be displayed in some versions of Visual Studio, inside intellisense tip windows.

        ''' <summary>
        ''' Summary for the method goes here
        ''' </summary>
        ''' <param name="value">Param comments go here</param>
        ''' <remarks></remarks>
    Private Sub SomeMethod(ByVal value As Decimal)
    
    0 讨论(0)
  • 2021-02-03 18:55

    All you have to do is key three apostrophes on the line before your function. .NET will add the rest of the code for you. Insert the text you want displayed in the intellisense in the tag.

    ''' <summary>
    ''' Returns the name of the code.
    ''' </summary>
    Function GetName() As String
        Return "Something"
    End Function
    
    0 讨论(0)
提交回复
热议问题