Today I had to write a solution of the following problem – imagine you have two lists like this:
1 2 3 4 5 6 7 8 9 10 11 |
var liPhoneBook = new List<tuple<int,string>>(); liPhoneBook.Add(Tuple.Create(100, "Pesho")); liPhoneBook.Add(Tuple.Create(200, "Gosho")); liPhoneBook.Add(Tuple.Create(300, "Atanas")); liPhoneBook.Add(Tuple.Create(400, "Az")); liPhoneBook.Add(Tuple.Create(500, "Ivan")); liPhoneBook.Add(Tuple.Create(600, "Ivan Petrov")); liPhoneBook.Add(Tuple.Create(900, "Vitosh")); List liNumbers = new List (new int[]{900, 300,400,100,600}); |
What I needed to write was a program, printing the names of the users in liNumbers. Something like this. As…