Generic Dictionary KeyValue pair with a boolean?


New member
Dec 18, 2013
Programming Experience
Okay, so heres part of the code I have:



I'm trying to add a Boolean value with each keyvalue pair I add. Is this even possible?. I need to be able to add/remove books to the dictionary, and also for each book to have a loan status denoted by a Boolean.

I'm using a Windows Form if that's of any help.
Last edited:
Firstly, is 'book' really a good name for that Dictionary? Does it represent a single book? Certainly not, so it's a bad name. The name should make it clear what the variable holds.

As for the question, it's basically a moot point. You shouldn't be using a Dictionary<string, string> anyway. You already have a Book class and that class already has a Boolean OnLoan property. Use them. You should be using a Dictionary<string, Book> or, if that 'input' value corresponds to the title of the book, just a List<Book>. The Book objects in the collection then contain the information about whether that book is on loan or not, which is the whole point of having a class in the first place.
Top Bottom