views:

55

answers:

2

I want to be able to decorate classes and methods with the text that intellisense shows when you are instantiating the class or accessing a field.

For example, I want to give usage instructions.

I can't find the appropriate decoration for this. How do I do it?

+7  A: 

Just add this to the top of your class definition...

/// <summary>
/// Returns a pointless string
/// </summary>
/// <param name="name">Parameter to personalise the rubbish returned</param>
/// <returns>Utter junk is returned</returns>

Where summary is what is shown for the class description, a param node for each element which describes each parameter and return statement describing what's returned.

timothyclifford
An addition to this, if you just type `///` on the row above the property/method/variable, it'll add all of the necessary XML tags.
Bevin
One more question. If you say "StringBuilder sb = new " it says "Represents..." - what is the attribute for that text?
IanC
Try reading documentation. It is pretty clear in the .NET documentation what XML commens support.
TomTom
@TomTom did it ever occur to you that the documentation is gigabytes in size, and one has to know the correct terminology to be able to search it? Do you think I would have posted the question before looking? Why do you think we have tutorials and support sites such as this one?
IanC
That is part of the core langauige definitions. Reading this part is sort of not optional.
TomTom
A: 

I think this can be done by using Componenet model

Afnan
I found the answer. Simply add the /// comment to the beginning of the definition of the class (as opposed to constructor et al).
IanC