According to Wikipedia Interoperability is a property referring to the ability of diverse systems and organizations to work together (inter-operate). The term is often used in a technical systems engineering sense, or alternatively in a broad sense, taking into account social, political, and organizational factors that impact system to system performance.
The .NET Framework (pronounced dot net) is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability (each language can use code written in other languages). Programs written for the .NET Framework execute in a software environment (as contrasted to hardware environment), known as the Common Language Runtime (CLR), an application virtual machine that provides important services such as security, memory management, and exception handling. The class library and the CLR together constitute the .NET Framework.
Because computer systems commonly require interaction between new and older applications, the .NET Framework provides means to access functionality that is implemented in programs that execute outside the .NET environment. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework; access to other functionality is provided using the P/Invoke feature.
How to make Interoperability program between C# and vb.Net
here I am going to create a simple .dll using vb.net languages for simple arithmetic calculation of two parameter. and then calling these .dll using C# code to display the accomplishment of Interoperability feature.
How to design vb.Net code
Follow the procedure step by step to design dll using vb.net
and then you can write simple given code for manipulating arithmetic calculation of two values. have a look four function name ADD,Subs,Mult and Div having two parameter in each function.
Public Class Arithmatic
Public Shared Function ADD(ByVal x As Double, ByVal y As Double) As Double
Return x + y
Public Shared Function Subs(ByVal x As Double, ByVal y As Double) As Double
Return x - y
Public Shared Function Mult(ByVal x As Double, ByVal y As Double) As Double
Return x * y
Public Shared Function Div(ByVal x As Double, ByVal y As Double) As Double
Return (x / y)
now Compile program, while compiling program you will get message like given below.. [ .dll file have been created ]
you can see the VBMath.dll file at corresponding directory as bin directory of your program.
How to design C# application
after creating library using vb.net its time to create C# application to use Interoperability program. let see how to design C# program and what code need to write.
its will open your program. now you need to right click on program name like(PrgrmIntrprbltyCheck) resides in Solution Explorer) and then Click on Add Reference mention in below image.
It will open Add Reference window. now navigate appropriate .dll file as Example VBMath.dll ) for adding for further coding.
Now the given code is influencing the concept how to use library written in vb.net languages with C# languages. code will show program for Simple Calculation of two numeric values.
public static void Display(double res, string condition)
Console.WriteLine("The " + condition + " of two number is : " + res);
static void Main(string args)
Console.WriteLine("Enter Your Option");
Console.WriteLine("1 For Addition");
Console.WriteLine("2 For Substraction");
Console.WriteLine("3 For Multiplication");
Console.WriteLine("4 For Devision");
Console.WriteLine("Enter your Option");
int op = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the First Value");
double n1 = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the First Value");
double n2 = double.Parse(Console.ReadLine());
Display(VBMath.Arithmatic.ADD(n1, n2), "Addition"); // Here VBMath.Arithmatic.Add(n1,n2) is function written in VB.Net
Display(VBMath.Arithmatic.Mult(n1, n2), "Substraction");
Display(VBMath.Arithmatic.Mult(n1, n2), "Multiplication");
Display(VBMath.Arithmatic.Div(n1, n2), "Devision");
Console.WriteLine("Invalid Option Try again...");
Console.WriteLine("Do you want to Carry On...");
ch = char.Parse(Console.ReadLine());
while (ch == 'y' || ch == 'Y');
you can see here how Function written in vb.net langues is accessing here. its just because of Interoperability supported by .Net framework.
Now run program for getting how application working..