Skip to content

Introduction to C#

Definition

C# (pronounced "C-sharp") is a modern, object-oriented programming language developed by Microsoft. It was first released in 2000 as part of the .NET framework, and it is designed to be used for building a wide range of applications, from simple command-line programs to complex, enterprise-level applications. C# is a type-safe, managed language, meaning that the runtime environment automatically handles memory management and other low-level details, allowing developers to focus on writing code. C# is a statically-typed language, meaning that types are checked at compile-time rather than at runtime. This makes C# programs more efficient and less prone to runtime errors.

Build

Windows

To build dotnet project you need to install Visual Studio.

MSDN :

Command to generate a self-contained PE without symbols.

dotnet publish -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:DebugType=none -p:DebugSymbols=false -p:PublishTrimmed=true

Linux

On Linux you can install mono which is a .NET compiler and runtime.

Arch : sudo pacman -S mono

Compilation :

$ vim Main.cs
$ mcs Main.cs
$ file Main.exe
Main.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows