From 95d5b547dcdfb83cccfc540fdc3b5f8154f5a071 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 23 Nov 2023 09:57:47 +0100 Subject: [PATCH] vault backup: 2023-11-23 09:57:47 --- Prog/Collections.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Prog/Collections.md b/Prog/Collections.md index c85a6c6..0a8949b 100644 --- a/Prog/Collections.md +++ b/Prog/Collections.md @@ -54,7 +54,17 @@ public static class Program { namespace Lecture; public static class Program { public static void Main() { - var dict = Dictionary< + var dict = Dictionary(); + dict.Add(3, "tree"); + dict.Add(9, "nine"); + dict[9] = "nine"; + dict[4] = "four"; + dict.Add(4, "quatre"); // Raise an exception because key 4 exists + Console.WriteLine($"{dict[4]}"); // Return four + foreach (var kv in dict) { + Console.WriteLine($"dict[{kv.Key}] == {key.value}"); + } + } }