Reference/Imports

J

Jim Heavey

Hello, I am trying to understand how to properly use the "reference" and
"imports".

If I create a "solution" with 2 projects, do they both sare the same
namespace?

When I use the IDE to create a reference between Project1 and Project2 in
that solution, I am actually providing the physical address of where the
reference project(project2) resides. Where is this information stored - or
to put it another way, if I was not using the IDE, how would I go about
creating a reference?

I made the Namespace for Project2 be "Fred" and the class which this
namespace contains is "Fred". What would my "Imports" statement look like.
I have tried "Fred" and "Fred.fred", but it does not seem to like either.

Thanks in advance for your assistance!!!!!!!!!
 
J

Jan Tielens

See my responses below...

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
Jim Heavey said:
Hello, I am trying to understand how to properly use the "reference" and
"imports".

If I create a "solution" with 2 projects, do they both sare the same
namespace?
No, you can define your default namespace for each project. You can even
define your namespace in code. So even in one single project, it's possible
to have more than 1 namespace.
When I use the IDE to create a reference between Project1 and Project2 in
that solution, I am actually providing the physical address of where the
reference project(project2) resides. Where is this information stored - or
to put it another way, if I was not using the IDE, how would I go about
creating a reference?
In VS.NET you create a reference to a project that's in the solution (some
sort of GUID I think is stored). Another way to create a reference is to
choose a compiled assembly (dll) to link to.
I made the Namespace for Project2 be "Fred" and the class which this
namespace contains is "Fred". What would my "Imports" statement look like.
I have tried "Fred" and "Fred.fred", but it does not seem to like either.
If the namespace is Fred, then the imports should look like:
Imports Fred
But be aware that VB.NET also has a default namespace (check the project
properties). So it's possible that your imports would look like:
Imports Project2.Fred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top