scope of types in an assembly

G

Guest

Hi,
Is it true that the CLR does not see any namespaces but only the assembly
while executing? can i have two types which have the same name in different
namespaces inside the same assembly and still have my program work? this
wldnt be possible if the runtime doesnt see namespaces?
thanks
shikher
 
S

Scott Allen

It's true the runtime doesn't use namespaces per se, but the runtime does
only use a type's full name, which includes the namespace.

For instance, the following lines:

Type t = typeof(Int32);
Console.WriteLine(t.FullName);

Would spit out:
System.Int32

Thus the runtime would know the difference between Namespace1.MyClass and
Namespace2.MyClass - they have different full names.
 

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

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top