.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Implementing Cross Language Assembly : Practical scenario

Posted By:Gaurav Arora       Posted Date: April 29, 2009    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  
 

Cross Language Assembly Implementation

 

Introduction:


In the available example you have to create another .net language application lets say here you will create a Visual BAsic.NET class application.
Following we have two code snippet one is showing Cross Language Assembly while another implementing the same:

The following is the VB.Net code(s):


' This Example is a part of different
' examples shown in Book:
' C#2005 Beginners: A Step Ahead
' Written by: Gaurav Arora


REM File name : vbClass.vb
Namespace CSharp.AStepAhead.crossLanguageAssembly
    Public Class vbClass
        Protected X, Y As Integer

        Public Sub New(ByVal U As Integer, ByVal V As Integer)
            X = U
            Y = V
        End Sub
        Public Overrides Function ToString() As String
            Return "Entered Numbers are : " & X.ToString() & " , " & Y.ToString()
        End Function
    End Class
End Namespace



Another is the C# code(s):



/* This Example is a part of different
* examples shown in Book:
* C#2005 Beginners: A Step Ahead
* Written by: Gaurav Arora


using System;
using System.Collections.Generic;
using System.Text;
using crossLanguageAssembly.CSharp.AStepAhead.crossLanguageAssembly;

namespace CSharp.AStepAhead.crossLanguageClientApplication
{
    class crossLanguageClientClass
    {
        static void Main(string[] args)
        {
            Console.Clear();
            Console.Write("\n Enter First Number : ");
            int num1 = int.Parse(Console.ReadLine());
            Console.Write("\n Enter Second Number : ");
            int num2 = int.Parse(Console.ReadLine());

            vbClass myObj = new vbClass(num1, num2);
            Console.WriteLine("\n Result : " + myObj.ToString());
            Console.ReadLine();
        }
    }

}

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend