DLL is a library which may contain code, data or other information that can be accessed by other program at the same time.
DLL full form is Dynamic link library.
It is of two types:
Static link: If it is used, then DLL file will be use till the program is Active.
Dynamic link: If it is used then DLL file will be used when it is required.
DLL Advantage:
* Reduces the duplication of code which is loaded on the disk and in physical memory.
Explanation : As multiple program which contain same DLL executing in the memory, then single DLL is required for the multiple program.
* Easy Updates and installation:
Explanation : When there is some improvement or update in the DLL file then update is not required for all the program only update is required.
Here is the small program to explain concept of dll:
Please follow these step :
* Open the New project , select class Library.
Now write your program
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary1 { publicclassClass1 { publicint adding(int a, int b) { return a + b; } publicint subtract(int a, int b) { return a - b; } publicint multi(int a, int b) { return a * b; } publicint divi(int a, int b) { return a / b; } } }
Save your code and then Press F6 or click on build on menu bar, under build click on build solution Check dll file will build , under bin -->debug--> dll file.
Now, open the console application and write your code : Note : Before running your code you need to add the class library to the console program For this you need to open Solution Explorer present under View button. Under solution explorer, right click on the name of name of the program , click on add reference , new window will be open click on browse button0 and add the dll file. And at last click on StartUp project. And then execute your program.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ClassLibrary1; namespace ConsoleApplication1 { classProgram { staticvoid Main(string[] args) { Class1 obj = newClass1(); Console.WriteLine("Enter the 1st number"); int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the 2nd number"); int num2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Addition of two num: \nresult= {0}\nSubtraction of two num:\nresult= {1}\nmultiplication of two num:\nresult={2} ", obj.adding(num1, num2), obj.subtract(num1,num2),obj.multi(num1,num2)); if (num2 == 0) { Console.WriteLine("Division is not possible"); } else { Console.WriteLine("Division of two num is:\nresult={0}", obj.divi(num1, num2)); } Console.ReadLine(); } } }
Liked By
Write Answer
Can anyone explain about dll.
Join MindStick Community
You have need login or register for voting of answers or question.
Abhishek Srivasatava
22-Sep-2016Hi Samuel,
DLL is a library which may contain code, data or other information that can be accessed by other program at the same time.
DLL full form is Dynamic link library.
It is of two types:
Static link: If it is used, then DLL file will be use till the program is Active.
Dynamic link: If it is used then DLL file will be used when it is required.
DLL Advantage:
* Reduces the duplication of code which is loaded on the disk and in physical memory.
Explanation : As multiple program which contain same DLL executing in the memory, then single DLL is required for the multiple program.
* Easy Updates and installation:
Explanation : When there is some improvement or update in the DLL file then update is not required for all the program only update is required.
Here is the small program to explain concept of dll:
Please follow these step :
* Open the New project , select class Library.
Now write your program
Save your code and then Press F6 or click on build on menu bar, under build click on build solution
Check dll file will build , under bin -->debug--> dll file.
Now, open the console application and write your code :
Note : Before running your code you need to add the class library to the console program
For this you need to open Solution Explorer present under View button.
Under solution explorer, right click on the name of name of the program , click on add reference , new window will be open click on browse button0 and add the dll file.
And at last click on StartUp project. And then execute your program.