A collection of C# examples progressing from basic console I/O to advanced patterns such as delegates, threads, and LINQ. Each folder contains a self-contained project with its own README.md.
| # | Topic | Key Concepts | Folder |
|---|---|---|---|
| 001 | External Argument | Main(string[] args), command-line arguments, for loop |
001-ExternalArgument |
| 002 | Two Words | Basic class structure, System.Console.WriteLine |
002-TwoWords |
| 003 | Min & Max Range of Data Types | Decimal, Single, Double min/max values, exponential format |
003-MinimumRange |
| 004 | Operators | Arithmetic, logical, comparison operators, switch statement |
004-Operators |
| 005 | Largest of Four Numbers | if comparisons, sequential max-finding |
005-Four-Numbers |
| 006 | Five Numbers – Sum & Average | for loop, accumulator, integer vs. float division |
006-Five-Numbers-Sum-and-Average |
| 007 | Two Numbers Triangle | Nested loops, triangle pattern, decrement | 007-Two-Numbers-Triangle |
| 008 | C# Types | int, long, float, double, decimal, char, bool, string |
008-CSharp-Types |
| 009 | Number to Words | while loop, modulo, string array, string concatenation |
009-Num-to-Words |
| 010 | Explicit Type Casting | (short), (int) casts, data loss, GetType() |
010-Cast-Int-Short-and-Float-Int |
| 011 | Class – Before .NET 5 | Traditional class + Main boilerplate, using System |
011-Class-Before-dotnet-5 |
| 012 | Class – After .NET 5 | Top-level statements, minimal syntax | 012-Class-After-dotnet-5 |
| 013 | Arrays Without Try-Catch | Arrays, IndexOutOfRangeException crash |
013-Without-Try-Catch-Numbers-Array |
| 014 | Arrays With Try-Catch | try/catch, Exception.Message |
014-Try-Catch-Numbers-Array |
| 015 | Try-Catch Custom Error Messages | Multiple catch blocks, specific exception types |
015-Try-Catch-Numbers-Array-CustomErrorMessage |
| 016 | Namespaces – Calculator | namespace, multi-file project, using directives |
016-Namespace-Calculator |
| 017 | Solution with Multiple Projects | .sln, dotnet new classlib, project references |
017-Solution-and-projects |
| 018 | Delegates – Calculate | delegate type, delegate instance, method reference |
018-Delegate-Calculate |
| 019 | Delegates – Print (Callback) | Lambda expressions, delegate as parameter, File.AppendAllText |
019-Delegate-Print |
| 020 | Play Sound with NAudio | NuGet package, embedded resources, Mp3FileReader, WaveOutEvent |
020-Play-Sound-Naudio |
| 021 | Observer Design Pattern | Observer pattern, interface, List<T>, polymorphism |
021-Observer-Pattern |
| 023 | Threads | Thread, ThreadStart, Thread.Sleep, concurrency |
023-Threads |
| 024 | LINQ Filter | System.Linq, query syntax, method/lambda syntax, Where() |
024-LINQ-Filter |
- .NET SDK (version 5 or later recommended)
Navigate to the inner project folder (the one containing the .csproj file) and run:
dotnet runOr from the example's root folder:
dotnet run --project <ProjectFolderName>Example:
cd 001-ExternalArgument
dotnet run --project ExternalArgumentApp -- Hello WorldCSharpTutorial/
├── README.md ← You are here
├── 001-ExternalArgument/
│ ├── README.md
│ └── ExternalArgumentApp/
├── 002-TwoWords/
│ ├── README.md
│ └── TwoWords/
... (one folder per example)
└── 024-LINQ-Filter/
├── README.md
└── AppLinqFilter/
- 001 – External Argument
- 002 – Two Words
- 008 – C# Types
- 011 – Class Before .NET 5
- 012 – Class After .NET 5