David Chen

David Chen

  • NA
  • 50
  • 45.7k

KeyValuePair Dictionaries Help

Oct 7 2010 9:45 PM

I provided the source code, it basicly retrieves data from a file and read that file store it into a List then outputting it by using KeyValuePair
Below is where I am currently at, and final output, the difference is "Author Name: " and final output is "Author Name: Bruna Martinuzzi" (with respective order)


It will output like this but im dont know how to start by creating an Authors Dictionary. I need to enable cross referencing between authors.csv and books.csv data files and parse the data from each line of the authors.csv file and store it in an Author object. store each author object in a dictionary collection named authors. then when initialiizing the Book object look up the author's first and last names from this Dictionary


Department Name: Clothing
Floor: 2
Price: 23.44
Price with taxes: 26.72
Product: tennisT by Nike
Department Name: Clothing
Floor: 2
Price: 42.35
Price with taxes: 48.28
Product: Sweat Top by Reebok
Department Name: Clothing
Floor: 2
Price: 38.99
Price with taxes: 44.45
Product: Khaki Casuals by LaCoste
Department Name: Reading
Floor: 1
Price: 12.78
Price with taxes: 13.67
Title: The Leader as a Mensch
Publisher: Six Seconds
Author Name:
Department Name: Reading
Floor: 1
Price: 23.44
Price with taxes: 25.08
Title: Software Teamwork: Taking Ownership for Success
Publisher: Addison-Wesley Professional
Author Name:
Department Name: Reading
Floor: 1
Price: 45.99
Price with taxes: 49.21
Title: ASP.NET MVC 1.0
Publisher: Wrox Press
Author Name:
Department Name: Reading
Floor: 1
Price: 7.54
Price with taxes: 8.07
Magazine Name: Wired
Issue Month: September Issue Year: 2010
Department Name: Reading
Floor: 1
Price: 5.88
Price with taxes: 6.29
Magazine Name: PC World
Issue Month: September Issue Year: 2010

But I want to get it like this

Department Name: Clothing
Floor: 2
Price: 23.44
Price with taxes: 26.72
Product: tennisT by Nike
Department Name: Clothing
Floor: 2
Price: 42.35
Price with taxes: 48.28
Product: Sweat Top by Reebok
Department Name: Clothing
Floor: 2
Price: 38.99
Price with taxes: 44.45
Product: Khaki Casuals by LaCoste
Department Name: Reading
Floor: 1
Price: 12.78
Price with taxes: 13.67
Title: The Leader as a Mensch
Publisher: Six Seconds
Author Name: Bruna Martinuzzi
Department Name: Reading
Floor: 1
Price: 23.44
Price with taxes: 25.08
Title: Software Teamwork: Taking Ownership for Success
Publisher: Addison-Wesley Professional
Author Name: Jim Brosseau
Department Name: Reading
Floor: 1
Price: 45.99
Price with taxes: 49.21
Title: ASP.NET MVC 1.0
Publisher: Wrox Press
Author Name: Scott Guthrie
Department Name: Reading
Floor: 1
Price: 7.54
Price with taxes: 8.07
Magazine Name: Wired
Issue Month: September Issue Year: 2010
Department Name: Reading
Floor: 1
Price: 5.88
Price with taxes: 6.29
Magazine Name: PC World
Issue Month: September Issue Year: 2010

Attachment: help.zip

Answers (3)