Method Description

Hi i was wondering how to create a method on my class so when u call it u can see a brief description of what that method do. for example when u call System.Console.WriteLine u can see that it say "Writes the representation of the array objects........................" and after that also say what expcetions could be thrown by calling this method,, and i was wondering how to add this description and alos how to add the exception list..

i allready tried the System.ComponentModel.Description and put it right before the method, but no results..

mig16


Answer this question

Method Description

  • imj

    In your test project you need to tell it to output the XML Documentation file. In VS 2003 you would do

    Project Properties->Configuration Properties->Build->XML Documentation file. then you would type typically {Project Name}.xml.

    Then your client application will see the XML comments in the IntelliSense.

    I don't have VS 2005 on my work PC so I can't check whether this option is set in exactly the same menu order.


  • MikeAtOpco

    Hmm... it works fine for me. For example if I write this function:

    /// <summary>

    /// Test method help

    /// </summary>

    /// <param name="a">Param a help</param>

    /// <exception cref="System.Exception"/>

    private void Test(int a)

    {

    }

    When I use this method I get the same type of help as I get for .NET Framework methods.


  • Corres

    Hmm... even in this case (the class is in a separate project) works for me. Are you using VS2005 or VS2003 I don't remember if it worked in VS2003...
  • wetcoloredarch

    yea im on vs 2005....

    and thanks,,, ill keep looking whats the problem.

    mig16

  • Gianluigi.Zanettini

    mig16,

    The suggestions that Mike and Kevin have given seem correct to me.  There are a few differences between VS 2005 and VS 2003.  First, if your test project depends on your Windows Form project through a Project reference, and both projects are in C#, then you shouldn't even need to generate the XML file in order to have quick info display the summary tag of the doc comment.  If the reference has been added as a File reference then the steps given above should work; however, you must name the XML file identically to the assembly ( - the extension).  That is, the XML file for ClassLibrary1.dll should be ClassLibrary1.xml.  The XML file must also be located next to the .dll (i.e. in the same folder location).  I wrote a white paper that contains a walkthrough for developing components that have XML documentation in VS 2003 - it's available here

    The test project is calling the methods that you'd like to document directly correct (i.e. it's not invoking them through reflection)

    Anson

     



  • .NET Developer

    mmm, thanks again, so it loks that something is wrong with my solution. look i have 2 projects in my solution.. i have a project with my class and a project (winForm) for test that class,,i copy / pasted ur code and compiled it,,, then went to the test project and call the method but it has no description.. some 1 have an ide of what can be happening

    PD: i also removed the reference of the test project and add it again after compiling and still dont show description :s

    mig16

  • Ovidiu Padurean

    thanks, but that does not work, i want to show the description when im programming, when u call a net.Framework method u can see a brief description of what does method will do.. and thats what i want.

    mig16

  • robertlamour

    Perhaps XML Documentation Comments is what you are looking for

    http://msdn2.microsoft.com/en-us/library/b2s063f7.aspx


  • BenK95781

    it still dont work, i tried to otput the class project and also the test project and still dont work, any ideas

    mig16

  • Method Description