DEV Community

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

Posted on

2 1 1 1 1

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.

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed
  • 2:34 --only-changed
  • 4:27 --repeat-each
  • 5:15 --forbid-only
  • 5:51 --ui --headed --workers 1

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

Top comments (3)

Collapse
 
devh0us3 profile image
Alex P

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

sharplab.io/#v2:C4LglgNgNAJiDUAfAA...

Image description

Collapse
 
jarrydpatel profile image
JarrydPatel

So true! Thanks @devh0us3

Collapse
 
insight_it_891bf8cd689700 profile image
Insight IT
Comment hidden by post author

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

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed: Zero in on just the tests that failed in your previous run
  • 2:34 --only-changed: Test only the spec files you've modified in git
  • 4:27 --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • 5:15 --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • 5:51 --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay