DarkPh03n1X
DarkPh03n1X

Reputation: 680

How to find using directives

I wold Like To Know How To Easily Find using directives eg.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;

I am Learning how to use VS2013 & c#,so i Google a lot of things.Some times i get a chard of code and VS says:

The type or namespace name 'somenamespace' could not be found (are you missing a using directive or an assembly reference?) 

Then i Google a lot to find the correct using namespace ,time wasted. is there a library i can search for it, or a video that would show me how to find these things?

Upvotes: 1

Views: 2774

Answers (3)

Alireza
Alireza

Reputation: 5056

Visual Studio's Intellisense will assist you with this kind of problem. Just enter the type name, then press Alt+Shift+F10 and if the type is inside any of the referenced assemblies you will get options of add a Using Namespace or change TypeName to Namespace.TypeName.

Upvotes: 2

sasha_gud
sasha_gud

Reputation: 1735

Both Visual Studio 2010 and 2012 suggest you suitable namespaces even without any additional tools or libraries.

Just point to class name that needs additional using directive and you will see small rectangle below which will bring out a popup. On the picture you can see both ReSharper and VS popups.

You can also check the class name in the MSDN. It always show you the namespace for current class like:

Namespace: System.IO

Assembly: mscorlib (in mscorlib.dll)

VS popup sample

Upvotes: 2

brainless coder
brainless coder

Reputation: 6430

Use resharper. http://www.jetbrains.com/resharper/

This is one of the fantastic features I like resharper for. Once you install resharper, it will automatically popup while typing and also you can force invoke the type importer with Ctrl + Space.

There is an example, notice how it automatically found the namespace- enter image description here

Upvotes: 2

Related Questions