C# – How to build own libraries in C#

Ever building a code, which you would like to have in every program you make? Most probably. So, if you are coding in C#, this is the way to do it – through libraries.

cs

So, these are the steps:

  1. In Visual Studio – File>New Project>Class Library.
  2. Then open the class library and make the classes. Compile it. You need to make sure that a *.dll file is generated in the debug folder of the project.
  3. When you want to use the library in a new project, go to References in the Solution Explorer and add the library *.dll file through the browse button. Then everything works perfectly, even the intelli-sense.
  4. Here are some screenshots 🙂

save1 save2

And here comes the code, executed with a library.

The code:

The library:

Enjoy it! 😀

 

Tagged with: ,