Adding description to method?

Discussion in 'ASP .Net Building Controls' started by lisa, Apr 21, 2005.

  1. lisa

    lisa Guest

    In VS.NET, when you hit . and get a list of possible properties and
    methods, a tooltip comes up that gives you the footprint of each
    method, and often a description of what the method is for.

    When I create my own control and add properties and methods, the
    tooltip appears the same way. But there's no description, which makes
    sense, because I didn't add one.

    So my question is: How do I add one?

    Thanks.
     
    lisa, Apr 21, 2005
    #1
    1. Advertisements

  2. Steve C. Orr [MVP, MCSD], Apr 21, 2005
    #2
    1. Advertisements

  3. lisa

    lisa Guest

    Thanks, Steve. Unfortunately, I don't think that works for methods.
    work in C#. Which would be great, except that's not the choice my
    employer made. <sigh>

    Thanks again,
    Lisa
     
    lisa, Apr 21, 2005
    #3
  4. lisa

    johndoe Guest

    These are called XML comments and are provided via the /// in C#. From the
    looks at it VB.NET currently does not support Inline Comments the way C#
    does. This is on the feature-list for vb.net 2005 supposedly. so this
    inforamtion may be completely useless to you in which case skip down to the
    end.
    if you type /// on the line before a method then VS.NET will automatically
    insert an xml comment for the method. Note that this is 3 /'s versus the

    /// <summary>
    /// Adds a Dental Patient
    /// </summary>
    /// <param name="dp">New dental patient to add.</param>
    /// <returns>Returns the new index that the patient was added at.</returns>
    public Int32 Add (DentalPatient dp)

    Your comment goes in between the <summary> tags. Parameter description goes
    in between param.

    Disclaimer: VS.NET's IntelliSense can be EXTREMELY broken so this very well
    may end up not working or maybe it works some of the times. I use a plugin
    offered by WholeTomato which enhances my Intelli-Sense so this ensures that
    this works all the time. Therefore if it doesnt work and you have made sure
    that all of the assemblies are updated and reflecting the new one then this
    may very well be why.

    Somebody claims that VS.NET can't even do it See
    http://www.dotnet4all.com/Dot-Net-Books/2005/01/adding-method-descriptions.html and so if the above sample does not work for you
    http://www.gotdotnet.com/team/ide/


    Hope this helps.
     
    johndoe, Apr 21, 2005
    #4
  5. lisa

    Shark Bait Guest

    I think this is want you want. Go into project properties ("XML Document
    File") and output the XML too...
    /// <summary>
    /// Returns a DataSet using a stored procedure and SqlParameter array passed
    to it.
    /// </summary>
    /// <param name="storedProc">Stored procedure name.</param>
    /// <param name="sqlParams">A SQL Parameter array.</param>
    /// <param name="tableName">Table name you want returned to you in the
    DataSet.</param>
    /// <returns>A DataSet with a single table of the provided name
    included.</returns>
    /// <example>
    /// <code>
    /// This is an example, blah blah...
    ///
    /// </code>
    /// </example>
    public DataSet GetDataSetSP(string storedProc, SqlParameter[] sqlParams,
    string tableName) {
    some code blah balh blah....
    }
     
    Shark Bait, Apr 21, 2005
    #5
  6. I think you want the XML commenting functionality of C#.
    Unfortunately VB.NET doesn't have this yet, but the functionality is
    included in VB2005 which is scheduled for release later this year.
     
    Steve C. Orr [MVP, MCSD], Apr 21, 2005
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.