473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Q: Namespaces in Assemblies

Hi group,

I am relatively new to .NET and am trying to wrap my brain around a concept.

Say I have Assembly A1 that contains three namespaces, N1, N2, and N3.

If I add A1 as a reference to my project, am I right in thinking that I can
perform Imports N1 and that the remaining namespaces, N2 and N3, will not be
loaded into memory? Or by the very fact that I added a reference to A1, all
namespaces and classes are loaded into memory when A1 is accessed?

Perhaps I'm overthinking this, but it seems that maybe I am on the cusp of
actually grasping the whole concept of assemblies and namespaces, and I
wanted someone to further enlighten me.

Thanks for any input.
Richard
Nov 4 '05 #1
3 1387
Or by the very fact that I added a reference to A1, all
namespaces and classes are loaded into memory when A1 is accessed?


Yes, all publicly accessible types in that assembly can be used,
regardless which namespace they are in.
Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 4 '05 #2
Perhaps I am misunderstanding your question...but will try with what I
have..
At execution time, the IL is compiled to native code and loaded into
memory. By default, only the IL that is needed is JIT'ed and loaded
into memory. As a result (If I understand your question) just because
the assembly has some code in it doesnt mean that it will be
loaded/JIT'ed at runtime.

Mattias Sjögren wrote:
Or by the very fact that I added a reference to A1, all
namespaces and classes are loaded into memory when A1 is accessed?

Yes, all publicly accessible types in that assembly can be used,
regardless which namespace they are in.
Mattias

Nov 4 '05 #3
From a simpler point of view than the other replies:

the "Imports N1" is just a shortcut to save you from typing N1.SomeClass.
It's a compiler thing versus an execution/memory/loading thing.

Scott
"Richard J" <Ri******@discussions.microsoft.com> wrote in message
news:F2**********************************@microsof t.com...
Hi group,

I am relatively new to .NET and am trying to wrap my brain around a
concept.

Say I have Assembly A1 that contains three namespaces, N1, N2, and N3.

If I add A1 as a reference to my project, am I right in thinking that I
can
perform Imports N1 and that the remaining namespaces, N2 and N3, will not
be
loaded into memory? Or by the very fact that I added a reference to A1,
all
namespaces and classes are loaded into memory when A1 is accessed?

Perhaps I'm overthinking this, but it seems that maybe I am on the cusp of
actually grasping the whole concept of assemblies and namespaces, and I
wanted someone to further enlighten me.

Thanks for any input.
Richard

Nov 6 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raymond Lewallen | last post by:
It could help if you understood the project I work on a bit, but I can't tell you anything about it, so do the best you can under that pretense. Lets say you have a global assembly supporting...
2
by: RickN | last post by:
a) Is it best to split up a large application into multiple namespaces and multiple referenced projects or minimize the splits to all required client code in one client dll and all required server...
1
by: Josema | last post by:
Hi, My question its more about the theory about how to organize namespaces, assemblies, etc... Im very desorganized, and sometimes i create for instance some classes and namespaces, but when...
17
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
3
by: Richard J | last post by:
Hi group, I am relatively new to .NET and am trying to wrap my brain around a concept. Say I have Assembly A1 that contains three namespaces, N1, N2, and N3. If I add A1 as a reference to my...
1
by: Epetruk | last post by:
Hello, I have a solution with two projects. One of the projects is called MyProj with a root namespace called MyProj.Obj. The single source (vb) file for MyProj has a class called Obj....
2
by: OHM \( One Handed Man \) | last post by:
I have two assemblies with a different implementation of the same class Lets say ns1 and ns1 with the class Widget. I add the references to the project and put in aliases in each of the...
6
by: =?Utf-8?B?TUNN?= | last post by:
What is the difference between importing a namespace at the: 1. Project level 2. web.config level 3. Page level What are the requirements/benefits of each? If I import a namespace such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.