C# Demo Examples
Practice programs, one file each. Open a file in the code viewer, download it, modify it, and run it with
dotnet run. Organized by lesson category.
How to use: click View to open a file in the code viewer, read its comments, download it, and run it in your own project with dotnet run. Each file is self-sufficient — no hidden dependencies.
Foundations
Syntax, variables, operators, control flow, loops, and methods.
| # | Description | Link |
|---|---|---|
| 1 | Hello, World | View |
| 2 | Variables & Types | View |
| 3 | Operators | View |
| 4 | Control Flow | View |
| 5 | Loops | View |
| 6 | Methods | View |
Composite & Collections
Structs, classes, records, arrays, and generic collections.
| # | Description | Link |
|---|---|---|
| 7 | Struct | View |
| 8 | Class | View |
| 9 | Record | View |
| 10 | Arrays | View |
| 11 | List<T> | View |
| 12 | Dictionary | View |
I/O & Files
Console interaction and text file handling.
| # | Description | Link |
|---|---|---|
| 13 | Console I/O | View |
| 14 | Files | View |
Reliability
Error handling, casting, and strings.
| # | Description | Link |
|---|---|---|
| 15 | Error Handling | View |
| 16 | String Functions | View |