Namespaces and Assemblies

G

Guest

I have a library of classes. Some of my applications don't need all the
classes in the library. I assume if I import this class library into an
application then all classes will be imported; I have three questions?

1) Is this correct in that all classes will be imported and increase the
size of my final assembly?

2) If I use namespaces for individual classes and import only that name
space will all of the classes still be included in my applicaiton and
increase the size of the final assembly?

3) If I add a reference to a class library but don't import it will it still
be added to my final assembly?

Thanks for any clarification on these questions.
 
I

Imran Koradia

Dennis said:
I have a library of classes. Some of my applications don't need all the
classes in the library. I assume if I import this class library into an
application then all classes will be imported; I have three questions?

1) Is this correct in that all classes will be imported and increase the
size of my final assembly?

2) If I use namespaces for individual classes and import only that name
space will all of the classes still be included in my applicaiton and
increase the size of the final assembly?

3) If I add a reference to a class library but don't import it will it
still
be added to my final assembly?

What do you mean by 'import this class library'? Do you mean just adding the
Imports statement on top of the source file (or in the project properties)?
The Imports statement does not 'import' anything as such. If you have a
class library, you simply add its reference to your application and then use
the Imports statement simply to be able to reference members from the class
library without explicit qualifications. That's all the Imports statement
does. Your class library exists as a seperate assembly - either in the GAC
if its a global one or in your application folder (being copied over). So as
such, what ever code you write in your application is what makes up your
assembly size. Ofcourse, since the application is dependent on the class
library, you need to deploy the class library as well - regardless whether
you are using only class or many classes from the library - along with your
application whenever you do so. That should pretty much answer all three of
your questions.


hope that helps..
Imran.
 
G

Guest

Thank you. You have answered all of my questions in that any assembly.dll
used in my application must also be deployed with my application.exe. Thanks.
 

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