Quick Tip – Locating Namespaces in Visual Studio

When I’m using Visual Studio 2013 Community (for free too!) while working on my pet project, I’ve come to realize how dependent I’ve become upon Resharper for a lot of simple programming needs. While attempting to build some code and compile it, it turns out I was missing a namespace reference that I didn’t immediately know where to find it. After a little experimentation, here’s a trick I found that helps about 90% of the time.

Here are the quick pictures/steps.

1. Build and see your problems…

findnamespace_1

Yep, I can’t compile, a couple namespaces are missing.

2. Move the cursor to the object and press F12

findnamespace_2

The F12 command is the “Go to Definition” command used to easily navigate to a function or object definition, giving you the details on its structure and methods. Click the cursor on the type of object you need the details for and press F12. The “symbol results” window will pop up some options for you.

3. Add using statement for the namespace you need.

findnamespace_3

Once you know the namespace you need add the appropriate using statement to the top of the page. In my case, I added two or three and bingo I have properly compiling code!

If you know any other tricks, pass them along!

What are your 10 bits on the matter? I want to know!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s