It is a platform-independent language. Regardless of any language that supports. net, the relevant compiler generates the pencil command. For example, the following C #CodeA simple calculator
// *. CS
Using system;
Namespace cilexample
{
// ApplicationProgramPortal
Public class cilapp
{
Static void main ()
{
Calc calc = new calc ();
Int result = Calc. Add (10, 84 );
Console. writeline ("10 + 84 = {0}", result );
// Press enter to end the program
Console. Readline ();
}
}
// C # Calculator
Public class calc
{
Public int add (int x, int y)
{
Return X + Y;
}
}
}
When you compile this code, you will get a single file *. EXE assembly. This program contains a list of assembly, a pencil command, and a description of calc.
And cilapp data. For example, if you use ildasm.exe to open the assembly, you will find that the add () method is expressed:
. Method public hidebysig instance int32 add (int32 X, int32 y) di-managed
{
. Maxstack 2
. Locals int ([0] int32 CS $1 $0000)
Il_0000: ldarg.1
Il_0001: ldarg.2
Il_0002: add
Il_0003: stloc: 0
Il_0004: Br. s il_0006
Il_0006: ldarg.0
Il_0007: Ret
}
Now we use VB. NET to create the same program as above.
// *. VB
Imports system
Namespace cilexample
Module cilapp
Sub main ()
Dim C as new calc
Result = C. Add (10, 84)
Console. writeline ("10 + 84 = {0}", result)
Console. Readline ()
End sub
End Module
Class calc
Public Function add (byval X as integer, byval y as integer) as integer
Return x + y
End Function
End Class
End namespace
If you look at his or her pencil code, you will find very similar, with only a few differences.
. Method public hidebysig instance int32 add (int32 X, int32 y) di-managed
{
. Maxstack 2
. Locals int ([0] int32 add)
Il_0000: NOP
Il_0001: ldarg.1
Il_0002: ldarg.2
Il_0003: Add. ovf
Il_0004: stloc.0
Il_0005: Br. s il_0007
Il_0007: ldarg.0
Il_0008: Ret
}
From this, we can see that the obvious benefit of the pencil is the integration of language.
Each. Net-supported compiler generates almost identical pencil commands. Therefore, all languages can define clear binary files to interact with each other.
In addition, the Server Load balancer is platform independent.
Here, we will give you a more detailed description later.