Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment properties of a class for Visual Studio intellisense?

I know using /// to comment a function is the right way, and it also works for properties as shown by the following code

/// <summary>
/// This is for demo
/// </summary>
public class Foo
{
    /// <summary>
    /// Description A (working for intellisense)
    /// </summary>
    public int iA { get; set; }

    /// Description B (not working for intellisense)
    public int iB { get; set; }

    public int iC { get; set; }
}

enter image description here

I am wondering if there is a simpler way to comment class properties for intellisense than the /// which is 3 lines minimum.

like image 941
Hong Avatar asked Jan 24 '13 20:01

Hong


People also ask

How do you comment properties in C#?

Single-line comments start with two forward slashes ( // ). Any text between // and the end of the line is ignored by C# (will not be executed).

How do I comment a function in Visual Studio?

Type /// in C#, or ''' in Visual Basic. From the Edit menu, choose IntelliSense > Insert Comment.

How do I show IntelliSense in Visual Studio?

The suggestion list of Basic completion appears when you press the default Visual Studio IntelliSense shortcut Ctrl+Space . If necessary, you can always return to the Visual Studio's native's IntelliSense. To do so, select Visual Studio on the Environment | IntelliSense | General page of ReSharper options ( Alt+R, O ).

How do I use IntelliSense code in Visual Studio?

You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.) in JavaScript). Tip: The suggestions widget supports CamelCase filtering, meaning you can type the letters which are upper cased in a method name to limit the suggestions.


2 Answers

It's just XML. You can do it in one line if you want to.

/// <summary>Description A (working for intellisense)</summary>
public int iA { get; set; }
like image 170
ken Avatar answered Nov 15 '22 14:11

ken


You can you GhostDoc which generates some simple but useful comments automatically.

like image 33
daryal Avatar answered Nov 15 '22 13:11

daryal