Reputation: 2613
How can I create a namespace and classes in it, then save it, and reuse the namespace in other projects? Do I have to click on Create Class Library in Visual Studio?
Upvotes: 2
Views: 102
Reputation: 2613
I found the answer in Understanding and Using Assemblies and Namespaces in .NET
Here's what you need to do:
Create a Class Library
Build it to generate a .dll file
Upvotes: 3
Reputation: 14781
Sort of .. To create types and use them in several projects you need to place them in a seperate assembly. This assembly could be generated from a class library, or any other project type. The type of the assembly file could be either a dynamic library or an executable.
You can place those types in a specific namespace
. Also, you can place them in several namespaces.
To use these types from an external project you have to do the following:
Add a reference to the mentioned assembly.
Either importing the namespaces that contains those classes in your code file. Or, using their fully qualified names.
Refer to Implementing a Class Library in VB.NET
Upvotes: 2