Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically pull in references in Visual Studio c# like in Eclipse (java)

Tags:

c#

Is there a way to configure Visual Studio so that the intellisence will automatically inset "using" statements (reference to class library) just like in Eclipse (Java)?

This feature is really useful since visual studio only informs you a reference is missing but no suggestions are shown?

Am new to visual studio. Help will be highly appreciated.

like image 532
Ibexy I Avatar asked Sep 15 '12 10:09

Ibexy I


2 Answers

with the caret over the Type declaration you just typed, press CTRL + ALT + F10 a context menu appears offering to add the using statement. Also apparently (see JohnD's answer) CTRL + . works too and I just tried it, cool, we learn something new every day!

EDIT

oops! sorry that should be: SHIFT + ALT + F10

enter image description here

Of course that relies on having the relevant dll assembly referenced in the project

enter image description here

like image 161
hollystyles Avatar answered Sep 28 '22 06:09

hollystyles


If you select the expression that's not resolved, and hit CTRL+. (control-period) it will pop up a context menu to add the using statement.

like image 25
JohnD Avatar answered Sep 28 '22 05:09

JohnD