#21 USING A DLL IN C#
In this simple example I create a very simple DLL(Dynamic-link library) in C#. the library has to functions the first function is the Calculate
method which allows us initiate a simple addition of the numbers in each numerical box.The second function is a logger to keep track of the addition problems we solve. The WriteLine
method also shows us how we can write to and delete files in by calling methods from the dll_example_class_library.dll
we compiled.
A simple method called Calculate
just adds two numbers together using the dll_example_class_library.dll
DLL’s help to keep code more organised and also allow us to change functionality of programs without recompiling the EXE .
After the DLL is compiled we can add it to our project by: right clicking Refrences, clicking add reference, clicking browse and selecting our DLL
In order for us to use the methods in our class it has to first be initiated. Once initiated we can start using the methods in our logic.