---
title: "Can anyone explain about dll."  
description: "Can anyone explain about dll."  
author: "Samuel Fernandes"  
published: 2016-09-22  
updated: 2016-09-22  
canonical: https://www.mindstick.com/forum/34181/can-anyone-explain-about-dll  
category: "c#"  
tags: ["c#"]  
reading_time: 3 minutes  

---

# Can anyone explain about dll.

Hi Buddy\
I am working with [dll](https://www.mindstick.com/forum/34704/dll-dynamic-link-library-in-c-sharp) [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) can you [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) what is the use of it with help of program.I would really appreciate your help\
Thanks

## Replies

### Reply by Abhishek Srivasatava

Hi 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

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace ClassLibrary1{    public class Class1    {        public int adding(int a, int b)        {            return a + b;        }        public int subtract(int a, int b)        {            return a - b;        }        public int multi(int a, int b)        {            return a * b;        }        public int 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{    class Program    {        static void Main(string[] args)        {            Class1 obj = new Class1();            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();        }    }}
```

\
\
\

\


---

Original Source: https://www.mindstick.com/forum/34181/can-anyone-explain-about-dll

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
