C#:A Better Language
Essay by 24 • December 1, 2010 • 257 Words (2 Pages) • 1,633 Views
C# source code compiles into managed code. Managed code is an intermediate language (IL) because it is halfway between the high-level language (C#) and the lowest-level language (assembly/machine code).
At run time, the Common Language Runtime (CLR) compiles the code on the fly by using Just In Time (JIT) compiling.
An obvious con is the inefficiency of compiling the code at run time. This process is different from interpreting, which is typically used by languages such as Visual Basic, Perl and JScript.
The JIT compiler compiles a function or method only the first time, and when it does, it produces machine code native to the platform on which it's running. An obvious pro of JIT compiling is that the working set of the application is reduced, because the memory footprint of intermediate code is smaller. During the execution of the application, only the needed code is JIT-compiled.
Moreover, the CLR can optimize the program's execution on the fly at run time. For example, the CLR may determine a way to reduce page faults in the memory manager by rearranging compiled code in memory, and it could do all this at run time.
You can actually compile a C# program on a Windows platform and execute the output on both Windows and Linux without having to recompile, because even the file format is standardized.
The garbage collector frees you from the burden of handling memory allocation and deallocation, which is where many software errors can occur.
Accelerated C# 2008 Trey Nash APRESS Publishers 1-590-59-873-3
...
...