Multiple Classes and DLLs

sputnik75043

Member
Joined
Aug 28, 2010
Messages
13
Programming Experience
Beginner
Right now, I've got 3 separate class files in my project (fileIO.vb, etc.)
I'd like to separate them all out into one dll project (I supposed I would be using the same namespace as my current project - - or???)

As it stands now, if I want to instantiate one of the classes and use a method I do something like:
VB.NET:
Dim fi as new FileIO
fi.MyMethodName

If I create the new dll project and consolidate all my classes there, this is how I see it working ():
1. Add a reference to the DLL
2. Use the Import statement, using the DLL name, like other Namespaces
3. Instantiate each class and use the methods just like above.

Is this close to correct?
 
Just note that the DLL name and the namespace are not the same thing. They may be the same text but one assembly can contain types that are members of multiple namespaces and one namespace's members can be defined in multiple assemblies.

I would probably recommend using a different namespace for the types in the library to the types in the application. If it makes sense to break out those types into a separate library project then I don't see how it can be logical to use the same namespace. Also, if you envision that library being used in other applications then the namespace should be something general while that used in the application should be application-specific.

I would also recommend that you pick a "company name" and use that as the root of all your namespaces. For instance, when I worked for myself my business name was Wunnell Development (my middle name is Philip with one L :)) so all my namespaces are rooted with Wunnell, e.g. Wunnell.IO and Wunnell.ComponentModel.
 
Back
Top