C# is a modern, object-oriented, type-safe language by Microsoft that runs on .NET. Used for web (ASP.NET Core), desktop, games (Unity), cloud and mobile (MAUI).
Source → IL → JIT → native code
using System;
namespace HelloApp
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter your name: ");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}!"); // string interpolation
}
}
}
Q & A
-
What is the CLR?Common Language Runtime: the .NET virtual machine that JIT-compiles IL to machine code and manages memory with the garbage collector.
-
What is managed code?Code that runs under the CLR, so memory, security and exceptions are managed by the runtime.