Visual Studio/SharpDevelop, can we create hyperlink that lead to another part of the code in the solution?

StackOverflow https://stackoverflow.com/questions/14156423

Question

In Visual Studio and SharpDevelop, is it possible to create some kind of hyperlink or shortcut that lead to another portion of code simply by clicking on a word? At more than one reprise I would like to link a line of code to another part of the solution without using the search feature (which becomes time-consuming).

Another reason I want to do this is I would like to write some kind of table of content with explanations that allow to bring directly to the desired piece of code in the solution.

Was it helpful?

Solution 3

So far the best alternative I've found to my question is using the Task List Window. It's also possible to add new XML tokens and sort references by topics. Overall it greatly helps even though I hoped there was a better solution to this problem.

Task lists can be sorted alphabetically by their description, so it's possible to create some kind of table of content by using numerals while adding XML comments with the appropriate token. Note that new tokens can be added from the IDE options. In Sharp Develop, Tools > Options > General > Task List

Example:

In the source code:

// MY_TOKEN: 01 - Start of foo behavior

Later in the code or another file

// MY_TOKEN: 02 - More stuff related to foo behavior

Later in the code (or another file

// MY_TOKEN: 03 - More stuff related to foo behavior

Et cetera.

It looks like this in the IDE:enter image description here

Therefore from the Task List Window it's possible to quickly jump to the references.

Is someone has a better solution?

OTHER TIPS

Can you use the Go to Definition feature? You can go to the definition of a class, method, property, etc in Visual Studio with a keyboard shortcut or SharpDevelop using the mouse or a keyboard shortcut.

In SharpDevelop:

Hold down the Ctrl key and left click the item (class, method, property, etc) with the mouse. The corresponding file should then be opened. The keyboard shortcut to do this is Ctrl+Enter.

In Visual Studio:

Click the item and press F12 to go its definition.

If you have Resharper then it supports the Ctrl + left click to go a definition.

Within XML comments, you can use the cref attribute to set links to other classes/methods.

For example:

/// <seealso cref="OtherClass.OtherMethod"/>
void M() {}

Unfortunately neither Visual Studio nor SharpDevelop support the 'go to definition' feature on these links, so they're useless for navigation. Resharper might do better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top