C# Course · 49 lessons · approx. 335 minutes

Learn C#

C# is a programming language for the .NET platform. Among other things, you can use it to develop tools, servers and games. Our examples use top-level statements from modern C#: the first statement is the starting point, without you having to write a Main class right away. Every new building block is first explained on short pages. The coding exercises compare solution patterns without pretending to be a compiler; you can run free programs in the compiler with a suitable runtime.

  • Hallo, C#!
  • int: remember a number
  • string and text placeholders
  • Calculating and +=
  • bool and comparisons
  • if and else
  • for: three passes
  • List<int>: adding values
  • A local function
  • Your C# points coach
  • HashSet: every course only once
  • Dictionary: minutes per name
  • TryParse: checking number text without an exception
  • LINQ: selecting matching values
  • A class with properties
  • interface: a contract for classes
  • switch expression: cases in short form
  • foreach: visiting every element
  • try and catch: handling exceptions
  • Texts and arrays
  • LINQ in depth
  • Objects in depth
  • Exceptions and safe input
  • Lists and dictionaries
  • Interfaces, properties and generics

What you’ll learn

  1. Chapter 1From the first character to your own value – Starting point, output, variables and calculating.
    Hallo, C#! · int: remember a number · string and text placeholders · Calculating and +=
  2. Chapter 2Deciding and repeating – Check values and control small sequences.
    bool and comparisons · if and else · for: three passes
  3. Chapter 3Your own building blocks and a mini project – Organise data, build functions and connect what you have learned.
    List<int>: adding values · A local function · Your C# points coach
  4. Chapter 4Level up: your next practice chapter – Understand four new building blocks in small steps and use them yourself.
    HashSet: every course only once · Dictionary: minutes per name · TryParse: checking number text without an exception · LINQ: selecting matching values
  5. Chapter 5Master chapter: how real programs are built – Five building blocks from real projects – explained, connected, filled in and written by you.
    A class with properties · interface: a contract for classes · switch expression: cases in short form · foreach: visiting every element · try and catch: handling exceptions
  6. Chapter 6Texts and arrays – Split and rebuild texts, put them together efficiently and sort arrays.
    Split and Join · ToUpper, Contains and Replace · StringBuilder: building texts efficiently · Sorting arrays and ^1 · Boss: analysing words
  7. Chapter 7LINQ in depth – Converting, sorting, summarising and checking – in just a few lines.
    Select: converting every value · OrderBy: sorting by a key · Sum, Max, Count and Average · Any, All and First · Boss: a leaderboard
  8. Chapter 8Objects in depth – Properties with private set, records, inheritance, enum and abstract classes.
    Constructor and private set · record: data with value comparison · Inheritance: virtual and override · enum: a fixed choice · Boss: abstract shapes
  9. Chapter 9Exceptions and safe input – Catch errors, check input with TryParse, throw exceptions yourself and clean up with finally.
    Catching errors: try and catch · Checking without exceptions: int.TryParse · Raising the alarm yourself: throw · Cleaning up with finally · Boss: an exception of your own
  10. Chapter 10Lists and dictionaries – Grow a List<T>, look up values in a dictionary, loop over pairs, HashSet and a stock.
    Growing lists: List<T> · Looking things up: Dictionary · Looping over pairs: foreach over a dictionary · Every value only once: HashSet · Boss: a small stock
  11. Chapter 11Interfaces, properties and generics – Contracts with interface, computed properties, generic methods, static and a small shop.
    Contracts with interface · Computed properties · One method for many types: generics · Shared by all: static · Boss: a small shop

Final project: C# points coach

Combine variables, a decision and an output into your own points coach.

How it works

Every lesson starts with short explanation pages. Then you practise with multiple-choice questions, fill-in-the-gap tasks, putting code in order and writing your own code – with hints and instant feedback. Free, without ads, on phone, tablet and PC.

Learn C# now