Namespace syntax question


B

B. Chernick

I haven't made all that much use of 'Namespace' but I thought I understood
it. I'm in the process of translating a C# project to VB. (Dot Net 2.0)

In the program I'm working on now, I have a root namespace of <Name1>.<Name2>

In a project sub-folder I have a class file (call it Class2) with the
namespace of <Name1>.<Name2>.<Name3>

In the main directory, in the main class file (call it Class1), it is
necessary to reference items in Class2. The original C# version of Class1
had a declaration of 'using <Name1>.<Name2>.<Name3>; The VB equivalent
(Imports <Name1>.<Name2>.<Name3>) does not seem to work.

However 'Imports <Name1>.<Name2>.<Name1>.<Name2>.<Name3> does work.

What's am I forgetting?
 
Ad

Advertisements

F

Fred

B. Chernick said:
I haven't made all that much use of 'Namespace' but I thought I
understood
it. I'm in the process of translating a C# project to VB. (Dot Net
2.0)

In the program I'm working on now, I have a root namespace of
<Name1>.<Name2>

So just declare your class2 in Name3
(Or don't use root namespace)
 
Ad

Advertisements

D

David Anton

Clear out the 'root namespace' in the new VB project. VB regards everything
in the project as being in this namespace, while in C# the meaning of 'root
namespace' means little more than the default namespace to insert in new
classes.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
 

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