The Complete C# Learning Guide

C# (pronounced "C sharp") is a modern, statically typed language in the .NET ecosystem. It is used for web services, desktop software, cloud applications, and games.

How C# works

C# code is compiled to run on .NET. The compiler checks types, and the runtime manages memory for most objects while providing libraries for common application tasks.

What you will learn

You will begin with a small console program, then learn types, methods, classes, collections, exceptions, .NET libraries, and application projects.

How to use this guide

  1. Start with Chapter 1 and move through the chapters in order. New ideas build on the earlier ones.
  2. Type each example yourself, make a small change, and predict what will happen before running it.
  3. When a chapter is ready, its lesson will appear at the chapter link. These pages are currently blank lesson starters.

A step-by-step learning path

  1. Chapters 1-7: Learn the essentials. Run a console app, use typed values, read and print information, make decisions, repeat work, and write methods.
  2. Chapters 8-12: Model and process data. Work with arrays and collections, strings, references, resource handling, classes, structs, and records.
  3. Chapters 13-18: Organize dependable apps. Learn scope, namespaces and imports, assemblies and packages, files, exceptions, debugging, and tests.
  4. Chapters 19-24: Build practical projects. Explore algorithms, advanced C# features, safe and efficient design, the .NET toolchain, and guided projects.

C# ideas you will meet early

Your first C# program

In a .NET console project, put this code in Program.cs:

Console.WriteLine("Hello, world!");

Console.WriteLine writes text and then starts a new line. The string is inside quotation marks, and the semicolon ends the statement. In a terminal opened in the project folder, run:

dotnet run

Install the .NET SDK to create and run a project. For example, dotnet new console creates a starter console project; then use dotnet run inside that project's folder.

A simple way to study

First file: save your program in Program.cs in a .NET console project, then run dotnet run.

Course chapters

Follow the 24 chapters in order, or choose a topic to revisit. Each chapter opens its own lesson page.

  1. What C# is and how a program runs
  2. Your first program
  3. Values, types, and variables
  4. Input and output
  5. Expressions and operators
  6. Decisions and loops
  7. Functions and program structure
  8. Collections: arrays, lists, and slices
  9. Strings and text
  10. References, pointers, and memory
  11. Memory and resource management
  12. User-defined types and data modeling
  13. Scope, lifetime, and visibility
  14. Modules, imports, and declarations
  15. Multi-file programs, packages, and libraries
  16. The standard library and ecosystem
  17. File input and output
  18. Errors, debugging, and testing
  19. Data structures and algorithms
  20. Advanced language topics
  21. Safety, portability, and performance
  22. Build systems and professional workflow
  23. A project ladder
  24. Further study checklist
0% read