views:

86

answers:

3

In solution explorer of asp.net application we are adding something in References section for eg:in our project there are sample.Dal,sample.exeption ,system.core etc

What is actually References means,,,can we add by 'using' statement

A: 

Yes, once you reference another project or assembly, it's namespaces and types are available for use in the project that references them (you must reference the project or assembly before you can use the types within it).

You can either use using declarations or fully-qualified type declarations to access the types, as in:

// Example1: The using keyword.
using System;

void Example1()
{
   Int32 myExample;
   // etc.
}

// Example2: Fully-qualified type.
void Example2()
{
   System.Int32 myExample;
   // etc.
}

Note: I have used C# here.

Jeff Yates
+1  A: 

Using is used for namespace resolution. For example:

using System.Data;

lets you access the DataSet class without typing in the fully qualified name; System.Data.DataSet.

This doesn't however tell the compiler what assembly (DLL) the DataSet class lies in. So you need to tell it. So you refer to System.Data.dll by adding it to the references section in solution explorer.

Arjan Einbu
A: 

A reference references assemblies required for the current project. Where using statements reference namespaces for the current file.

And yes, a referenced namespace must exist in one of the referenced assemblies.

Nick Whaley