//use_dll_add.cs
//------------
//Compilation is done using "csc /target:library use_dll_add.cs "
using System;
//UseName.cs is the file which uses this dll.
namespace DllAdd
{
 public class add
 {
  public add() { Console.WriteLine("Constructor evoked"); }
   ~add() { Console.WriteLine("Destructor evoked"); }
  public int bonus(int b, int a)
  {
   int n = a + b ;
  
   Console.WriteLine("Hi,Your Total Sal is" + n + " this returns through dll");
   return n;
  }
 }
}
   

 
//test_dll.cs
// compile "csc /reference:use_dll_add.dll test_dll.cs"

using DllAdd;
using System;
public class test
{
public static void Main()
{
add sales = new add();
Console.Write("Enter Base Sal: ");
int base_sal = Int32.Parse(Console.ReadLine());
Console.WriteLine("----");
Console.Write("Enter Bonus: ");
int incent = Int32.Parse(Console.ReadLine());
sales.bonus(base_sal, incent);
}
}
 
complie the dll's

Now compile the test application

 

Now time to run and the test both.