.Net Interoprability
Hi .net newbies , In this article I will explain what .Net Interoperability really means? . You would have theoretically learnt the .Net supports Interoperability feature. We know Interoperability is the ability of two systems to communicate with each other, The first system could be built on .Net framework and the other system can be of some other technology.
Lets practically learn the concept of .Net Interoprability using Visual Studio tool between tow languages C# and VB in .Net.
Step 1:
Create a simple csharp .Net library which contains a method sayHello() as shown below :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace interoperability_CsLibrary
{
public class Class1
{
public void SayHello()
{
Console.WriteLine(“Hello");
Console.ReadLine();
}
}
}
Step 2:
Lets see how to call the C# sayHello() function in a VB project,
Create a simple VB code Module1 where I want to use the csharp method.
Import the library interoprability_CsLibrary and invoke the method.
Imports interoperability_CsLibrary
Module Module1
Sub Main()
Dim obj1 As Class1
obj1 = New Class1()
obj1.SayHello()
End Sub
End Module
Here you can see that ,we can use csharp method 'sayHello()' inside VB project!!!!,
But how it is possible!, The answer is .net converts the them into Intermidiate language (IL).