mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-27 15:14:35 +00:00
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:
parent
6662eb185e
commit
333085ee53
86 changed files with 2482 additions and 5 deletions
33
content/programovani/4-rocnik/05-soubory.md
Normal file
33
content/programovani/4-rocnik/05-soubory.md
Normal 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);
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue