How to add a mouse-over summary
I don't see why your first attempt wouldn't work. It's the <summary>
comment tag which supplies the 'tooltip' you're talking about...
/// <summary>
/// This text should automatically show up as the summary when hovering over
/// an instance of this class in VS
/// </summary>
public class MyClass
{
public MyClass() {}
}
public class MyClass2
{
public MyClass()
{
//hovering over 'something' below in VS should provide the summary tooltip...
MyClass something = new MyClass();
}
}
If you want help automating some of your commenting, try the free GhostDoc. By far one of the best free VS addons..
Two additions to check for that I just discovered will prevent the summary from showing when hovering:
Do not use ampersands (&
) or starting angle brackets (<
) in your summary description.
Breaks:
///<summary>
///Class does this & that
///</summary>
Instead use:
///<summary>
///Class does this AND that
///</summary>
Breaks:
/// <summary>
/// Checks if this < that
/// </summary>
This will work, but probably not a good precedent to set:
/// <summary>
/// Checks if this > that
/// </summary>
Do not separate the ///
lines from each other.
Breaks:
/// <summary>
/// This text will not show
/// </summary>
Breaks:
/// <summary>
/// This text will also not show
// because THIS line only has 2 dashes
/// </summary>
Works:
/// <summary>
///
/// This
///
/// is
///
/// fine.
///
/// </summary>
The three-slash XML comments may be used to create the IDE tool-tips in Visual Studio. In particular, "summary" and "exception" work very well. (Other things like "code" have not worked in the versions of Visual Studio that I have used.)
If this is not working for you, then something may be wrong with your settings.