





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to associative arrays using Dictionaries and SortedDictionaries in C#, as well as an overview of Lambda expressions and LINQ queries for filtering, mapping, and ordering collections. Learn how to use these powerful features for processing sequences and manipulating data structures.
Typology: Study Guides, Projects, Research
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















Collections and Queries
▪ Add ( key , value ) method ▪ Remove(key ) method Built-In Methods var airplanes = new Dictionary<string, int>(); airplanes.Add("Boeing 737", 130); airplanes.Add("Airbus A320", 150); var airplanes = new Dictionary<string, int>(); airplanes.Add("Boeing 737", 130); airplanes.Remove("Boeing 737");
▪ ContainsKey(key) ▪ ContainsValue(value) Built-In Methods (2) var dictionary = new Dictionary<string, int>(); dictionary.Add("Airbus A320", 150); if (dictionary.ContainsKey("Airbus A320")) Console.WriteLine($"Airbus A320 key exists"); var dictionary = new Dictionary<string, int>(); dictionary.Add("Airbus A320", 150); Console.WriteLine(airplanes.ContainsValue(150)); //true Console.WriteLine(airplanes.ContainsValue(100)); //false
Traditional Dictionary: Add() 10 Dictionary<string, string> Key Value Pesho 0881 - 123 - 987 Gosho 0881 - 123 - 789 Alice 0881 - 123 - (^978) Hash Function
Dictionary: Remove() 11 Dictionary<string, string> Key Value Hash Function Pesho Pesho 0881 - 123 - 987 Gosho 0881 - 123 - 789 Alice 0881 - 123 - 978
Anonymous Functions