Get Enhanced Code Examples from GitHub for your API Methods in Visual Studio 2022

Software category image

Place your mouse on an API method, press a shortcut, and Visual Studio shows you matching code examples from GitHub.

When you have to deal with APIs that you haven’t used before, it sometimes is hard to find out how they exactly work and what they can do.

Visual Studio can show you code examples from GitHub if there are any available for the corresponding code. Just type the method that you are struggling with and hover over it.

GitHub code example shortcut in Visual Studio tooltip
GitHub code example shortcut in Visual Studio tooltip

The tooltip shows the already-known method documentation but at the bottom, there is a new shortcut. Press it and the tool opens a window with code examples of that method. This handy tip might save you a Google search or a ChatGPT prompt!

This works only if you are using an API or Nuget package that is hosted on GitHub. However, the majority of public and famous Nuget packages already are.

Demo video of how Visual Studio shows GitHub code examples in the IDE
Demo video of how Visual Studio shows GitHub code examples in the IDE

Find more tips for Visual Studio here: