ReSharper 2021.3 Help

Copy code reference to clipboard

When you need to log or share the context of the current location, such as the name of the symbol under the caret or its XML-documentation ID, the path to the file or the VCS path, you can press Control+Alt+Shift+C and copy the desired reference from a popup:

ReSharper: Copying code reference to clipboard

Copy symbol name

When you invoke this command on any symbol (declaration or usage), it automatically copies its fully-qualified name to the clipboard. If you need the name or namespace only, you can choose those in the popup.

You may need the fully-qualified name of a symbol in different situations, for example, when you use reflection.

Copy XML-Doc ID

When you invoke this command within a namespace, type, or a member, you can choose XML-Doc ID from the popup to copy the XML-documentation ID of the enclosing entity. You can use this ID when referencing this entity in XML-doc comments of other symbols. For more information about the ID format, see Processing the XML File (C# Programming Guide).

For example, for the method MyMethod declared as

namespace MyNamespace { class MyClass { void MyMethod(){} } }

the XML-doc ID will be M:MyNamespace.MyClass.MyMethod

Copy paths and external links

You can also copy the path to the current file and line in any format. By default, there are two formats:

  • Path to the current line from the solution root, for example MyProject\MyFile.cs:25, and

  • If the current file is in a Git repository with GitHub as remote, you can choose to copy the GitHub URl to the file from the popup. For example: https://github.com/user/repo/blob/id/MyProject/src/MyFile.cs#L25.

To copy paths and links in a custom format, configure the URI patterns on the Environment | Search & Navigation | Source Browsing page of ReSharper options (Alt+R, O).

This way you can copy links to your code that will work with online code browsers such as JetBrains Upsource or Roslyn-based source browser.

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: HTML

Language: ASP.NET

Language: Razor

Language: JavaScript

Language: TypeScript

Language: CSS

Language: XML

Language: XAML

Language: Resx

Language: Build Scripts

Language: Protobuf

Language: JSON

Feature is available in C#

Feature is available in Visual Basic .NET

Feature is available in C++

Feature is available in HTML

Feature is available in ASP.NET

Feature is available in Razor

Feature is available in JavaScript

Feature is available in TypeScript

Feature is available in CSS

Feature is available in XML

Feature is available in XAML

Feature is available in Resource files

Feature is available in build script files

Feature is available in Protobuf

Feature is available in JSON

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by language section.

Last modified: 07 April 2022