Lecture 1 / 12
Lecture 01 ยท Fundamentals

Introduction to C# & .NET Setup

Beginner ~50 min No prerequisites

What is C#?

C# (pronounced "C-sharp") is a modern, object-oriented, type-safe programming language developed by Microsoft. It is part of the .NET ecosystem and is widely used for building Windows desktop applications, web services, games (Unity), cloud applications, and mobile apps.

Why C#?

  • Strongly typed & safe: Catches many errors at compile time.
  • Modern features: Async/await, LINQ, records, pattern matching.
  • Cross-platform: Runs on Windows, macOS, Linux via .NET 8+.
  • Excellent tooling: Visual Studio, VS Code, Rider.

Installing .NET SDK

Download the latest .NET 8 SDK from dotnet.microsoft.com.

terminal / cmd
dotnet --version
# Expected: 8.0.x or higher

Your First C# Program

Program.cs
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
        Console.WriteLine("Welcome to C# Mastery!");
    }
}
Output
Hello, World!
Welcome to C# Mastery!
๐ŸŽฏ Exercise 1.1

Create a new console project and modify it to print your name, age, and favorite programming language.

Lecture 03 ยท Fundamentals

Operators & Expressions

Beginner ~45 min

Arithmetic Operators

C# supports standard arithmetic: +, -, *, /, and % (modulus).

Math.cs
int a = 10, b = 3;
Console.WriteLine(a + b); // 13
Console.WriteLine(a / b); // 3 (Integer division)
Console.WriteLine(a % b); // 1

Comparison & Logical Operators

  • Comparison: ==, !=, >, <, >=, <=
  • Logical: && (AND), || (OR), ! (NOT)
๐ŸŽฏ Exercise 3.1

Calculate the area of a circle using Math.PI and operators. Take the radius as an input.

Lecture 04 ยท Fundamentals

Control Flow: If & Switch

Beginner ~50 min

If-Else Statements

int temp = 25;
if (temp > 30) {
    Console.WriteLine("Hot");
} else if (temp > 20) {
    Console.WriteLine("Warm");
} else {
    Console.WriteLine("Cold");
}

Switch Expressions (Modern C#)

Modern C# uses a concise switch expression syntax.

string result = day switch {
    1 => "Monday",
    2 => "Tuesday",
    _ => "Unknown"
};
Lecture 05 ยท Fundamentals

Loops: for, while, foreach

Beginner ~45 min

Iterating with Loops

// Standard for loop
for (int i = 0; i < 5; i++) {
    Console.WriteLine(i);
}

// Foreach loop (best for collections)
string[] names = { "Ana", "Felipe", "Emilia" };
foreach (var name in names) {
    Console.WriteLine($"Hello {name}");
}
Lecture 06 ยท Core Concepts

Methods & Parameters

Intermediate ~55 min

Defining Methods

static int Add(int x, int y) => x + y;

void Greet(string name, string title = "Dr.") {
    Console.WriteLine($"Hello {title} {name}");
}
Lecture 07 ยท Core Concepts

Collections & LINQ

Intermediate ~60 min

Working with Lists

var numbers = new List<int> { 10, 20, 30, 40 };
numbers.Add(50);
numbers.RemoveAt(0);

Introduction to LINQ

LINQ (Language Integrated Query) allows you to query collections like SQL.

var highScores = numbers.Where(n => n > 25).OrderByDescending(n => n);
Lecture 08 ยท Core Concepts

Strings & Formatting

Beginner ~40 min

String Manipulation

string text = "  C# Programming  ";
Console.WriteLine(text.Trim().ToUpper());
Console.WriteLine(text.Contains("C#"));

String Interpolation

Console.WriteLine($"Date: {DateTime.Now:d}");
Console.WriteLine($"Price: {19.99:C}"); // Currency
Lecture 09 ยท Advanced

Object-Oriented Programming

Advanced ~75 min

Classes & Objects

public class Person {
    public string Name { get; set; }
    public virtual void Work() => Console.WriteLine("Working...");
}

public class Developer : Person {
    public override void Work() => Console.WriteLine("Coding...");
}
Lecture 10 ยท Advanced

Exceptions & File I/O

Intermediate ~50 min

Handling Errors

try {
    int x = int.Parse(Console.ReadLine());
} catch (FormatException ex) {
    Console.WriteLine("Invalid number format.");
} finally {
    Console.WriteLine("Done.");
}

Reading/Writing Files

File.WriteAllText("log.txt", "Hello C#");
string content = File.ReadAllText("log.txt");
Lecture 11 ยท Advanced

The .NET Ecosystem

Intermediate ~45 min

NuGet & Libraries

Use dotnet add package to install community libraries like Newtonsoft.Json.

Asynchronous Programming

public async Task<string> GetDataAsync() {
    var client = new HttpClient();
    return await client.GetStringAsync("https://api.example.com");
}
Lecture 12 ยท Capstone

Capstone Project: Task Manager

Advanced ~120 min

Build a console-based Task Manager that uses everything we've learned: Lists, LINQ, OOP, and File I/O.

// Project requirements:
// 1. Add/Remove tasks
// 2. Mark tasks as complete
// 3. Save tasks to tasks.json
// 4. Filter tasks using LINQ