Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: Can I add links in comment blocks

I'm coding software, where I very often need to do graphical illustrations, to explain the behavior of the code, e.g. illustrate geometrically how the shortest distance is found from one of the sides in a triangle to a hit-point in that triangle.

It is getting kind of tedious to use and invent ascii-representations in the comments, so I was thinking if it is possible to embed drawings (pictures created in drawing programs) into the project/solution and link to them in the comment-blocks.

like image 883
Tim Holst Petersen Avatar asked Oct 29 '14 19:10

Tim Holst Petersen


2 Answers

Yes you can. The pictures even don't need to be included in the project. VS will automatically create a clickable link from any URL placed anywhere in the comment. I recommend you to place the URL inside standard <see> comment tag. Our VSdocman supports also the <img> tag that will show the picture directly in generated documentation.

Here is the example that uses both ways. In both cases you can click the link directly in the code editor and the picture will show.

/// <summary>
/// Click <see href="file:///C:\Pictures\Desert.jpg">here</see> to See the picture.
/// </summary>
/// <remarks>Here is the embedded picture:
/// <img src="file:///C:\Pictures\Desert.jpg"/>
/// </remarks>
public void Method1() { }
like image 180
Peter Macej Avatar answered Nov 01 '22 17:11

Peter Macej


ImageComments extension for VS 2010/2012 allows images to be displayed amongst code.

like image 2
Sergey Vlasov Avatar answered Nov 01 '22 18:11

Sergey Vlasov