





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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