Skip to main content

.Net Interoprability

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).

Comments

Popular posts from this blog

Asp.Net Web API

What is ASP.NET Web API? ASP.NET Web API is a framework provided by the Microsoft with which we can easily build HTTP services that can reach a broad of clients, including browsers, mobile, IoT devices, etc. ASP.NET Web API provides an ideal platform for building RESTful applications on the .NET Framework.   Difference between ASP.NET Web API and WCF Web AP I is a Framework to build HTTP Services that can reach a board of clients, including browsers, mobile, IoT Devices, etc. and provided an ideal platform for building RESTful applications. It is limited to HTTP based services. ASP.NET framework ships out with the .NET framework and is Open Source. WCF i.e. Windows Communication Foundation is a framework used for building Service Oriented applications (SOA) and supports multiple transport protocol like HTTP, TCP, MSMQ, etc. It supports multiple protocols like HTTP, TCP, Named Pipes, MSMQ, etc. WCF ships out with the .NET Framework. Both Web API and WCF can be self-hosted or can be...

Creating package in Oracle Database using Toad For Oracle

What are Packages in Oracle Database A package is  a group   of procedures, functions,  variables   and  SQL statements   created as a single unit. It is used to store together related objects. A package has two parts, Package  Specification  and Package Body.