static void Main(string[] args) { BiDictionary <string, int, string> bidictionary = new BiDictionary <string, int, string>(true); bidictionary.Add("Nasko", 4, "PHP"); bidictionary.Add("Joro", 3, "C#"); bidictionary.Add("Petar", 4, "C++"); bidictionary.Add("Raicho", 1, "PERL"); bidictionary.Add("Filip", 4, "Java"); bidictionary.Add("Sasho", 2, "Listy"); Console.WriteLine(string.Join(" ", bidictionary.GetByFirstKey("Joro"))); Console.WriteLine(string.Join(" ", bidictionary.GetBySecondKey(3))); Console.WriteLine(string.Join(" ", bidictionary.GetByFirstAndSecondKey("Sasho", 2))); Console.WriteLine(bidictionary.Count); bidictionary.RemoveByFirstKey("Raicho"); Console.WriteLine(bidictionary.Count); bidictionary.RemoveBySecondKey(2); Console.WriteLine(bidictionary.Count); bidictionary.RemoveByFirstAndSecondKey("Nasko", 4); }
static void Main() { var biDictionary = new BiDictionary <int, string, string>(); biDictionary.Add(5, "Blagoevgrad", "Petkan"); biDictionary.Add(5, "Sofia", "Ivan"); biDictionary.Add(5, "Sofia", "Stamat"); biDictionary.Add(55, "Varna", "Shisho bakshisho"); biDictionary.Add(5, "Pleven", "Maria"); biDictionary.Add(15, "Sofia", "Minka Svirkata"); Console.WriteLine(@"biDictionary.Add(5, ""Blagoevgrad"", ""Petkan""); biDictionary.Add(5, ""Sofia"", ""Ivan""); biDictionary.Add(5, ""Sofia"", ""Stamat""); biDictionary.Add(55, ""Varna"", ""Shisho bakshisho""); biDictionary.Add(5, ""Pleven"", ""Maria""); biDictionary.Add(15, ""Sofia"", ""Minka Svirkata""); "); var five = biDictionary.FindAllByFirstKey(5); PrintEnumerable(five, "biDictionary.FindAllByFirstKey(5)"); var sofia = biDictionary.FindAllBySecondKey("Sofia"); PrintEnumerable(sofia, "biDictionary.FindAllBySecondKey(\"Sofia\");"); var fiveSofia = biDictionary.FindAll(5, "Sofia"); PrintEnumerable(fiveSofia, "biDictionary.FindAll(5, \"Sofia\")"); }
public static void Main() { BiDictionary <string, int, int> biDictionary = new BiDictionary <string, int, int>(); biDictionary.Add("One", 2, 3); var stringKeysValues = biDictionary.FindFirstKey("One"); foreach (var pair in stringKeysValues) { Console.WriteLine(pair); } var intKeysValues = biDictionary.FindSecondKey(2); foreach (var pair in intKeysValues) { Console.WriteLine(pair); } }
public static void Main(string[] args) { // Demo BiDictionary <string, string, string> people = new BiDictionary <string, string, string>(); people.Add("Ivan", "Ivanov", "Front-Ender"); people.Add("Ivan", "Ivanov", ".NET Ninja"); people.Add("Ivan", "Georgiev", "Web Developer"); people.Add("Ivan", "Georgiev", "Student"); people.Add("Georgi", "Ivanov", "Driver"); people.Add("Georgi", "Georgiev", "Lawyer"); var jobsOfPeopleWithFirstNameIvan = people.FindByFirstKey("Ivan"); var jobsOfPeopleWithFirstNameGeorgi = people.FindByFirstKey("Georgi"); var jobsOfPeopleWithSecondNameIvanov = people.FindBySecondKey("Ivanov"); var jobsOfPeopleWithSecondNameGeorgiev = people.FindBySecondKey("Georgiev"); var jobsOfPeopleWithNameIvanIvanov = people.FindByBothKeys("Ivan", "Ivanov"); Console.WriteLine("The jobs of the people with first name Ivan"); foreach (var job in jobsOfPeopleWithFirstNameIvan) { Console.WriteLine(job); } Console.WriteLine("\nThe jobs of the people with first name Georgi"); foreach (var job in jobsOfPeopleWithFirstNameGeorgi) { Console.WriteLine(job); } Console.WriteLine("\nThe jobs of the people with second name Ivanov"); foreach (var job in jobsOfPeopleWithSecondNameIvanov) { Console.WriteLine(job); } Console.WriteLine("\nThe jobs of the people with second name Georgiev"); foreach (var job in jobsOfPeopleWithSecondNameGeorgiev) { Console.WriteLine(job); } Console.WriteLine("\nThe jobs of the people with full name Ivan Ivanov"); foreach (var job in jobsOfPeopleWithNameIvanIvanov) { Console.WriteLine(job); } }