HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to C#VariablesData TypesOperatorsStringsListsConditions (if / else)Loops (for / while)Functions
REFERENCE
📖 Overview
🖥️ Output
📦 Variables & Types
🔢 Numbers & Math
✍️ String
📚 List & Dictionary
🔀 Condition & Loop
🧩 Function

C# lessons

Microsoft .NET language

C# is a language introduced by Microsoft in 2000 along with the .NET platform. It started from a foundation similar to Java, forged its own path over time, and today has become one of the most comfortable languages to write in, thanks to both its syntax and tooling support.

When thinking of C#, two main fields come to mind. First is enterprise applications: web services with ASP.NET Core, Windows desktop applications, and integrations between desktop and cloud. Second is game development — the Unity engine uses C#, and a large portion of the mobile game market is written using this duo.

A common misconception is that C# only runs on Windows. Ever since the release of .NET Core in 2016, Linux and macOS have been fully supported; running .NET on Linux servers is a standard choice today.

📖 Command Reference→
  • •

    Introduction to C#

    First steps into Microsoft .NET language C#: using, printing with Console.WriteLine, and comments.

    →
  • •

    Variables

    Variables with var and constants with const; specifying types and reassigning values.

    →
  • •

    Data Types

    int, double, string, bool; string interpolation ($) and text↔number conversion.

    →
  • •

    Operators

    Math (+ - * / %), comparison (== != < >) and logical (&& || !) operators.

    →
  • •

    Strings

    Length, casing, searching (Contains), and replacing (Replace).

    →
  • •

    Lists

    Creating List<T>, adding items (Add), count (Count), and printing with string.Join.

    →
  • •

    Conditions (if / else)

    Making decisions with if-else if-else; conditions in parentheses, blocks in curly braces.

    →
  • •

    Loops (for / while)

    Counting with for, iterating lists with foreach, conditional repetition with while.

    →
  • •

    Functions

    Local function definitions, parameters, return, and arrow (=>) concise syntax.

    →

What you will learn

  • Learning how to output text and define variables with Console.WriteLine
  • The type system, the var keyword, and type conversions
  • Flow control using conditional, loop, and switch statements
  • Classes, objects, properties, and inheritance
  • Collection management with List and Dictionary
  • Writing queries on data using LINQ
  • Executing asynchronous tasks with async and await

Who is this for?

  • Those who want to develop games with Unity
  • Those who will write enterprise web services or desktop applications
  • Developers working or planning to work within the Microsoft ecosystem

When to use?

C# is very powerful for Unity games, web APIs with ASP.NET Core, Windows desktop software, and enterprise integrations; the development experience it offers alongside Visual Studio is an added advantage.

It is not the first choice for fast data analysis, scientific computing, or small system scripts; Python or Bash are more practical there. JavaScript or TypeScript are also required for interface code running in the browser.

Frequently asked questions

Are C# and C++ in the same family?

Although their names are similar, they are different languages. C++ is a hardware-close language where you manage memory directly. In C#, memory is managed by a garbage collector, it runs on a virtual runtime environment, and its safety nets are much broader. Learning C# is easy for someone who knows C++, but knowledge doesn't transfer directly.

Does C# only run on Windows?

No. .NET Core and subsequent .NET versions officially support Linux and macOS. Running .NET on Linux in production servers is a common choice; development can also be done on any platform using VS Code.

Is learning C# enough for Unity?

On the language side, yes, C# is Unity's only scripting language. However, game development requires more than just the language: Unity's component structure, physics engine, scene management, and performance habits must also be learned. Solidifying the language first and then moving on to the engine is the healthiest sequence.

What is LINQ, and is it mandatory to learn?

LINQ allows you to write filtering, sorting, and grouping operations on collections almost like database queries. It is not strictly mandatory, but it is used in a large portion of C# code; not learning it means writing much longer code using loops.

Summary

C# is a language with robust tooling support covering a wide range, from enterprise software to Unity games. In this course, we progress from your first console output all the way to object orientation, collections, LINQ, and asynchronous programming.

HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code