I've created a new Class Library in C# and want to use it in one of my other C# projects - how do I do this?
Add a reference to it in your project and a using
clause at the top of the CS file where you want to use it.
Adding a reference:
DLL
you want to add a reference to.DLL
you want to use is in the same project. Instead, right-click the Project and then click Add Reference, then select the appropriate class from the Projects tab:
Adding a using
clause:
Add using [namespace];
to the CS file where you want to reference your library. So, if the library you want to reference has a namespace called MyLibrary
, add the following to the CS file:
using MyLibrary;