I have dictionary which holds my books:
Dictionary<string, book> books
Book definiton:
class book
{
string author { get; set; }
string title { get; set; }
}
I have added some books to the dictionary.
How can I check if there is a book in the Dictionary that matches the title provided by the user?
If you’re not using the book title as the key, then you will have to enumerate over the values and see if any books contain that title.
Or you can use LINQ:
If, on the other hand, you are using the books title as the key, then you can simply do: