Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for DotNet Basics: What is the Common Intermediate Language?
Jarryd
Jarryd

Posted on

     

DotNet Basics: What is the Common Intermediate Language?

The Common Intermediate Language (CIL), sometimes referred to as Intermediate Language (IL), is the low-level programming language that all .NET-compatible languages—such as C#, VB.NET, and F#—are compiled into.

How Does CIL Work?
Compilation Time: When you write code in a .NET language like C#, the compiler does not directly generate machine code. Instead, it compiles the source code into CIL.

Runtime Execution:
At runtime, the Just-In-Time (JIT) compiler translates the CIL into binary (machine) code, which is then executed by the CPU.
All .NET languages compile to the same intermediate language, this enables cross-language interoperability—for example, a C# class can inherit from an F# class seamlessly.

Viewing CIL Code
To see the CIL code generated from your .NET project, you can use the IL Disassembler (ildasm.exe) tool, which is included with the .NET SDK.

Steps to View CIL Code:

  1. Locate the compiled DLL or EXE:
  2. After building your project, navigate to bin/Debug/netX.X/ (replace X.X with your .NET version).
  3. Open ILDASM:
  4. Run ildasm.exe from the Developer Command Prompt.
  5. Drag and drop your DLL or EXE into ILDASM.
  6. This will show you the CIL code that your source code was compiled into.

What is the Just-In-Time (JIT) Compiler?
The JIT Compiler is a feature of the Common Language Runtime (CLR) that translates CIL into machine code at runtime, just before the code is executed. This allows .NET applications to run efficiently on different hardware architectures while still maintaining performance.

Why is CIL Important?

  • Interoperability: Different .NET languages can work together since they compile to the same CIL.

  • Portability: CIL code is platform-independent until JIT compiles it to machine code.

  • Security & Optimization: The CLR can apply runtime optimizations based on the executing environment.

Final Thoughts:
Understanding CIL and how the JIT compiler works gives you deeper insights into .NET's inner workings. Whether you’re debugging, optimizing performance, or experimenting with cross-language compatibility, knowing how .NET compiles and executes code can make you a better developer.

Top comments(3)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
devh0us3 profile image
Alex P
Secure Development, Certified Cybersecurity Professional
  • Joined

Hello, or just for fun you may use sharplab, example:

sharplab.io/#v2:C4LglgNgNAJiDUAfAA...

Image description

CollapseExpand
 
jarrydpatel profile image
Jarryd
Software Engineer specializing in Cloud-based solutions and Business Process Automation within the Financial sector.
  • Work
    Software Developer
  • Joined

So true! Thanks@devh0us3

CollapseExpand
 
insight_it_891bf8cd689700 profile image
Info Comment hidden by post author - thread only accessible via permalink
Insight IT
Insight IT Training Institute, located in the heart of Hyderabad, is a premier destination for IT education and skill development. we will provide Quality Training with 100% Placement Assitance.
  • Location
    Kphb, Hyderabad
  • Joined

Nice and informative content,
Thanks for sharing with us,
We are providing Best Dot NET Training in Hyderabad,

DOT NET Training in Hyderabad
DOT NET Online Training in Hyderabad
DOT NET Online Course in Hyderabad

Comment hidden by post author

Some comments have been hidden by the post's author -find out more

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Software Engineer specializing in Cloud-based solutions and Business Process Automation within the Financial sector.
  • Work
    Software Developer
  • Joined

More fromJarryd

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp