Using Private Assembly within Application in C#

In this article we will discuss about how to use the existing Private Assembly in our Application.
  • 2539

To use the existing DLL in our Application we have to follow the Following Steps:

  1. First open the Visual Studio 2010.

  2. Then click on File menu and select new option from it.

  3. Then click on Project menu and select any kind of application which you want to implement. Here we have created the console application.

  4. Now give the name to the application and click on OK.

  5. Now to use the DLL in our application we will add the reference of it in our application.

  6. Now to add the reference of the DLL in our application go to the solution explorer.

  7. Now right click on the project folder and select the add reference option.

  8. Now a window will open and in it click on the browser tab.

  9. Now go to the DLL location and select DLL then bin then Debug then mydll.dll(in previous article we have make the dll named mydll and we will use it in our application).

  10. Now we can use the classes,methods etc. of this dll.

  11. Now to use it also write the namespace as using System.mydll;

    Here is the code:

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using mydll;

     

    namespace myappp

    {

        class Program

        {

            static void Main(string[] args)

            {

                operation op = new operation();

                int result=op.add(23, 46);

                Console.WriteLine("The result is="+result);

                Console.ReadLine();

     

            }

        }

    }


    In the above code we have used the operation class and add method of our DLL.
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2019 DotNetHeaven. All rights reserved.