Course

C# from the ground up

The language of .NET

  • Beginner
  • 13 chapters
  • 210 min read

Learn C# by running it: printing and arithmetic, variables and the built-in types, interpolated text, decisions with if and switch, loops that repeat and walk collections, your own methods, arrays and lists, dictionaries, classes with properties and constructors, inheritance and interfaces, LINQ as the modern way to ask a collection a question, exceptions, and a spending report that uses the whole course at once.

What You'll Learn

  • Write and run a C# program, and say what the entry point is
  • Hold values in variables of the right type, and keep money in a decimal
  • Build readable lines with interpolation and format specifiers
  • Branch with if, else and switch, and combine conditions
  • Repeat work with for and while, and walk a collection with foreach
  • Write methods with parameters, defaults and return values
  • Store many values in an array or a list and walk them
  • Look values up by key in a dictionary
  • Define classes with properties, constructors and a useful ToString
  • Share work with a base class and hold different types behind an interface
  • Answer questions about a collection with Where, Select, OrderBy, Sum and Any
  • Throw, catch and name the exceptions a program can handle
  • Build a grouped spending report with records, LINQ and decimal money

Prerequisites

  • No programming experience needed — this course starts at the first line
  • Comfort with a text editor and a browser is the whole setup

Course Content

  1. 01
    Your first C# program

    What C# is for, the entry point every program needs, and Console.WriteLine as the way to make a program say something.

    Beginner · 12 min read

    Not started
  2. 02
    Values, var and the built-in types

    The types C# ships with, what var really means, integer division, and why money is a decimal and never a double.

    Beginner · 15 min read

    Not started
  3. 03
    Text, interpolation and formatting

    Building lines from values, the dollar sign that turns a string into a template, format specifiers, and the everyday string methods.

    Beginner · 15 min read

    Not started
  4. 04
    Decisions: if, else and switch

    Conditions that are true or false, chains with else if, combinations with and and or, and the switch that picks one branch to run.

    Beginner · 16 min read

    Not started
  5. 05
    Loops: for, while and foreach

    Repeating work a counted number of times with for, repeating while a condition holds with while, and walking a collection with foreach.

    Intermediate · 15 min read

    Not started
  6. 06
    Methods: a name for a piece of work

    Writing your own methods, passing values in, giving a value back, default values for parameters, and the short arrow form.

    Intermediate · 16 min read

    Not started
  7. 07
    Arrays and lists

    A fixed row of values and a list that grows, indexes that start at nought, and the two everyday ways to walk them.

    Intermediate · 16 min read

    Not started
  8. 08
    Dictionaries: looking things up by key

    A collection that answers by name instead of by position, adding and reading pairs, and the check that keeps a missing key from stopping the program.

    Intermediate · 16 min read

    Not started
  9. 09
    Classes: properties, constructors and ToString

    Defining your own kind of value, properties that read and write safely, a constructor that runs at creation, and the text an object prints.

    Advanced · 18 min read

    Not started
  10. 10
    Inheritance and interfaces

    A base class for what several values share, a derived class for what makes one special, and an interface as a promise one list can hold.

    Advanced · 18 min read

    Not started
  11. 11
    LINQ: asking questions of a collection

    Where, Select and OrderBy as one chain of questions, Sum, Any and Count for the answers, and why the calls read like the sentence you meant.

    Advanced · 17 min read

    Not started
  12. 12
    Exceptions: try, catch and throw

    Saying what went wrong with throw, handling what you can with catch, and giving a kind of trouble its own type so the program can tell them apart.

    Advanced · 16 min read

    Not started
  13. 13
    Putting it together: a spending report

    A capstone that uses the whole course once: records for the rows, LINQ to group them by category, and money formatted only on the way out.

    Advanced · 20 min read

    Not started