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
39
content/programovani/4-rocnik/02-list.md
Normal file
39
content/programovani/4-rocnik/02-list.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
id: cs-4-list
|
||||
nazev: List
|
||||
popis: Seznam, který umí růst.
|
||||
---
|
||||
|
||||
# Výklad
|
||||
|
||||
## Přidávání
|
||||
*Add*
|
||||
|
||||
- List<string> začne prázdný. Add přidá na konec.
|
||||
- Count je počet. Indexy jsou zase od nuly.
|
||||
- Na rozdíl od pole délku dopředu neříkáte.
|
||||
|
||||
> Tip: List<string> potřebuje špičaté závorky s typem prvku.
|
||||
|
||||
## Odebrání
|
||||
*Remove*
|
||||
|
||||
- Remove("Eva") odebere první Evu.
|
||||
- RemoveAt(0) odebere podle indexu.
|
||||
- foreach pak projde, co zůstalo.
|
||||
|
||||
> Tip: Přidejte třetí jméno před odebráním.
|
||||
|
||||
# Kód
|
||||
|
||||
```
|
||||
List<string> jmena = new List<string>();
|
||||
jmena.Add("Anna");
|
||||
jmena.Add("Eva");
|
||||
jmena.Remove("Eva");
|
||||
foreach (string j in jmena)
|
||||
{
|
||||
Console.WriteLine(j);
|
||||
}
|
||||
Console.WriteLine(jmena.Count);
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue