Click here to Skip to main content
15,668,646 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Dear sir, I need your help that I have written a code (in C#)
:- public class Books (that class Books is within the Namespace Stationary)
Now I want to access class Books from a class Magazine(However class Magazine is within the Namespace Library)
Sir, I think it is important to know such kind of accessing classes from One Namespace to another Namespace. Is there any possible to do so? If possible how? Can you help me sir.
Updated 20-May-11 15:59pm
Christian Graus 22-May-11 15:50pm    
This is a trivial question, and you should have accepted the first answer you were given. If you don't post code, we can't give you code in return, and if you can't understand an article on using namespaces, you should probably not be programming yet.

Check class Books namespace. you said that you have declare books as public. so it can be accessed from class Magazine. Just check the namespace of class books. and after that if it is not working just post your code here.
Share this answer
I think you should check the access modifier for book class.. make sure it is public first.

Secondly, make sure that Stationary library is referenced into Library project (name space).

Finally, you can access book class from magazine class using the name space of Stationary class.

Thanks :)
Share this answer
You mean like how you access the .NET classes from your namespace?
Share this answer
Take a look at Using Namespaces (C# Programming Guide)[^] link.It is a good place to start and manage your classes.

Good luck.
Share this answer
Christian Graus 22-May-11 15:49pm    
I 5 voted this b/c I assume the 1 came from the op b/c he could not understand your answer
Wonde Tadesse 22-May-11 15:59pm    
Thanks Christian.
NuttingCDEF 22-May-11 15:57pm    
My 5 too
Wonde Tadesse 22-May-11 15:58pm    
Thanks NuttingCDEF

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900