I have two projects within a single solution in Visual Studio 2010. These projects are called Project1 and Project2. Within these projects, two namespaces are defined, Namespace1 and Namespace2, respectively.
Inside some code within Namespace2, I'd like to use some structs, classes, etc. which I've defined in Namespace1. Is there any way to do this?
If you are adding a new class in your code then you may need to add the correspondence namespaces. To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code.
Yes, add a reference to Project1 from Project2. Right-click the project, choose "Add References" then from the "Projects" tab, choose Project1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With