views:

124

answers:

2

I am trying to add a description to functions I developed - I want this description to display in code insight when another developer is using my units or when a user uses API/COM to connet and uses our software. At the moment all they see is e.g. Function name and return type but they have no idea what the function does exactly.

in C# you use XML tags.

+1  A: 

I'm not sure that's what you need but:

    /// <summary>
    /// 
    /// </summary>
    /// <param name="par1"></param>
    /// <param name="bla"></param>
    /// <param name="foo"></param>
    /// <returns></returns>

Put this above a function declaration (just type the / character three times and visual studio will do the magic) In summary you have to put the description

astorcas
As an added bonus, if you have GExperts installed, you can type "xdoc" followed by Alt+Maj+T above your function declaration, and all the tags will be added automatically.
LeGEC
+3  A: 

Marco Cantu has a great blog post about how to use the same system of XML tags that Visual Studio uses to customize HelpInsight.

Mason Wheeler
+1. Unfortunately I can only get this to work on trivial (read: test) cases, not on my real code.
Cosmin Prund
Cosmin -- can you expand on what the problem is? It should work fine on "real code".
Nick Hodges
@Nick: The problem is that * Insight is badly borked in general, and degrades very rapidly in non-trivial codebases.
Mason Wheeler
@Nick Hodges -- The first test I did was on a brand new, empty form. It worked fine. Then I opened up one of my units and tried it over there, it didn't work. I noticed the "Strucutre" pane is full of errors (erroneous errors, obviously, but that's an different bug) so I tried with an other unit that wasn't displaying any errors on the Structure pane. It didn't work, so I decided the whole thing is "broken for real code" - sorry. Anyway, here's a 14 lines unit that brakes the XMLDoc in trivial code: http://fisiere.sediu.ro/Unit2.pas (code looks bad in comments)
Cosmin Prund