I want to put a comment that will let me get to a different block of code in c#

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



I want to put a comment that will let me get to a different block of code in c#



I think I could maybe use cref in the xml comments.



I also found a devious way using the nameof operator.


string fakeString = nameof( NewForm.HandleCommandLineArgments ); // use go to definition to get to NewForm.HandleCommandLineArgments



Any other ideas?



Update:
I realize how to go to definition, ideally I wouldn't have to add "string fakeString". I thought cref is a bit of a bummer since I thought it could only be in xml comments at the top of the method, but you can put them anywhere.



I'm going with:


/// <see cref="NewForm.HandleCommandLineArgments">
PipeClient.SendSimpleStringMessage( "scriptcode", "[Arguments]" + commandLineArguments );





Right click on it, select go to definition...
– Ron Beyer
9 hours ago





Put cursor on type and press F12 key.
– CodingYoshi
9 hours ago




1 Answer
1



In Visual Studio 2017, you can just use Ctrl+T (or whatever shortcut is assigned to Edit/Go To All) to go to any type. ReSharper has similar functionality even in earlier Visual Studio versions.


Edit/Go To All



More should not be necessary; and variables like your fakeString are really a code smell (and may even cause build/maintenance issues due to "unused variable" diagnostics).


fakeString



If it's something that is related to the method, it's also perfectly acceptable to include links in the XML Doc via <see cref="..."/> and/or <seealso cref="..."/>.


<see cref="..."/>


<seealso cref="..."/>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS