Add a C# course with a side-by-side code runner.

Each lesson explains a topic and runs the edited program next to the text through the local .NET SDK.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-10-11 14:37:14 +02:00
commit 333085ee53
86 changed files with 2482 additions and 5 deletions

View file

@ -0,0 +1,33 @@
---
id: cs-4-soubory
nazev: Soubory
popis: Zápis a čtení textu.
---
# Výklad
## WriteAllText
*jednou*
- File.WriteAllText zapíše celý soubor. Když existuje, přepíše ho.
- Cesta pozdrav.txt je vedle programu, v jeho složce.
- ReadAllText celý text vrátí jako string.
> Tip: Na telefonu se soubor nespustí. Na počítači s .NET ano.
## Řádky
*Append*
- AppendAllText přidá na konec a soubor nesmaže.
- ReadAllLines vrátí pole řádků.
- Po skončení programu soubor ve složce laboratoře zůstane.
> Tip: Spusťte dvakrát. Druhý zápis WriteAllText starý text nahradí.
# Kód
```
File.WriteAllText("pozdrav.txt", "Ahoj ze souboru");
string zpet = File.ReadAllText("pozdrav.txt");
Console.WriteLine(zpet);
```