public void IndexAllBooks() { if (BookIndexer != null) //commenting this line would create a warning since BookIndexer may be null { BookList.ForEach((currentBook) => { BooksDictionary.Add(BookIndexer.Index(currentBook), currentBook); }); } }