Csharp To Executable Code
Csharp To Executable Code
Csharp To Executable Code
It provides a
controlled programming environment where software can be developed, installed,
and executed mainly on Windows-based operating systems.
.NET 5 is the next step forward, unifying the .NET platform. .NET 5+ builds on .NET
Core, aiming to bring a single .NET runtime and framework that can be used
everywhere, ensuring uniform runtime behaviors and developer experiences.
Languages:
Development Tools:
Visual Studio: A powerful IDE from Microsoft for developing .NET
applications.
Visual Studio Code: A lightweight, open-source editor also from Microsoft,
suitable for .NET development with appropriate extensions.
Use Cases:
.NET is versatile and can be used for various types of applications such as:
Deployment:
.NET remains one of the predominant frameworks for building robust, scalable, and
maintainable software due to its extensive features, strong type-checking, just-in-
time compilation, and versatile libraries.
2. Compilation:
The C# compiler ( csc.exe) compiles the source code into an intermediate form, known as
Common Intermediate Language (CIL) or Microsoft Intermediate Language (MSIL). Alongside
the CIL code, metadata describing the types, members, references, etc., in the code, is also
generated.
public class Program .method public hidebysig static void Main() cil
managed
{
{
public static void Main()
.entrypoint
{
.maxstack 3
int x = 10;
.locals init (
int y = 20;
[0] int32 x,
int sum = Add(x, y);
[1] int32 y,
System.Console.WriteLine(sum);
[2] int32 sum
}
)
3. Assembly:
The CIL code and metadata are packaged together into an assembly. The assembly usually
has a .dll (dynamic link library) or .exe (executable) extension, depending on whether it's a
library or an application. An assembly contains a manifest, which has information about the
assembly's version, culture, and other assembly metadata.
1. Execute: When you run the program, the .NET runtime loads the assembly
and starts executing the CIL code within the context of the Common
Language Runtime (CLR).
2. CLR Runtime: The CLR provides various services like memory management,
security, and exception handling. It hosts the Just-In-Time (JIT) Compiler which
converts the CIL code in the assembly to Native Machine Code specific to the
host computer architecture and operating system.