Visual Studio: Creating a portable class library
This articles is how you can create your own .dll file in order to get your own functionality into the file, which can be used further in future or you can share it online to help others.
Why we need .dll?
So, the question arises, why we need to create .dll. With this very file, you don't need to write same functions again and again in order to get the same result. So, what we do, we create .dll, add the required class with required function to perform specific tasks and save it into dll form. which can be used later in other projects or you can share it with others so that they don't need to write same functions again.
Procedure:
follow the following steps in order to achieve your functionality in .dll form:
create project with C# in windows form application.
Add the Base Class Library(Portable) project in your solution.
Now, select your required frameworks in which you want to use your new defining Base Class Library(BCL) eg: silverlight, windows phone 8.1, IOS or etc.
Click OK.
you will see a new project is added into the solution of your solution explorer
Copy this class and name it whatever you want.
public class Class1 { public int add(int a, int b) { return a + b; } }
Now that you have added your project and code in it. Compile the code in order to get the dll.
The dll will be saved in the bin folder of project folder.
So, this is how one can create a portable class library which can be used at any platform or framework as you mentioned. In order to use it into one of your another object simply add the reference of your dll into your new project and access the methods by simply creating and calling a method from object.