views:

28

answers:

1

I knew from here that we have to do the explicit imports for child namespace because imports will not include the child namespace.

But my question is that if I do "imports System" whether it will include all the classes/methods inside that namespace in the IL/native code or only referred ( used inside the application) will be included in the IL/native code.

+2  A: 

Importing a namespace doesn't mean that anything is included in the code. It only means that the compiler recognises identifiers from that namespace.

The references in your project are what really decides which libraries the application is using. Still, the libraries are loaded when needed, they are not included in your executable file.

Guffa
so at the run time the referred namespace will be fully loaded or only required classes will be loaded in the memory?
Antoops
@Antoops: Well, the entire library will be loaded, but that doesn't neccesarily mean that all classes need to be run throught the JIT compiler and created. However, some classes in a library rely on others, so more classes than you use directly will have to be created.
Guffa