Friday, 4 November 2011

.net for beginners

.net is a technology that runs primarily on Microsoft Windows. .net is a platform which supports some programming languages like c#, VB, VC++ and many more.
Its architecture includes:
  • Class Library
  • CLS (Common Language Specification)
  • CLR (Common Language Runtime)

What is MSIL?
   MSIL, Microsoft Intermediate language code is a partially compiled code. 




To view MSIL:

suppose a simple windows application is created in c# having a button event: 


to view the IL code:
goto Start>> Microsoft Visual Studio Command Prompt>> and then type ildsm and click enter, then browse where  application is stored.


then IL code is shown like:


    notice the "Hello World"

CTS (Common Type System):
  As .net provides platform for different  programming languages. Therefore data types of different languages get compiled in a common data type.
For example, we have created a method "add" to add 1 to an integer in C# and in VB.


c# program code: 




VB program code: 


then in Microsoft Visual Studio Command Prompt run two instances of idasm. In first idasm open C# .dll file and in second instance open VB .dll file.
idasm of c# code: 


idasm of VB code: 




Check out both these instances of idasm have "Add" method with "int32" as common data type.


Hope you enjoyed learning this..I had fun..:)
  










No comments:

Post a Comment