C#

Dictionary<TKey, TValue>

Në shqip: Fjalori në C#

ShpjegimiSQ

Dictionary ruan çifte çelës–vlerë dhe e gjen vlerën shumë shpejt sipas çelësit. Me TryGetValue() e kontrollon pa gabim nëse një çelës ekziston.

EnglishEN

Dictionary stores key–value pairs and finds a value very quickly by its key. TryGetValue() checks safely whether a key exists.

Si ta mendosh

Si regjistri i notave: kërkon emrin, gjen notën menjëherë.

Lexoje në anglisht

Like a grade book: look up the name, find the grade instantly.

Shembull kodicsharp

var notat = new Dictionary<string, int> { ["Arta"] = 5 };
notat["Dren"] = 4;
if (notat.TryGetValue("Ilir", out int n)) Console.WriteLine(n);

Terma të lidhur