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
I created a list AddAuthors which retrieves data off from the data file then I split it and store each in a string array, authorDetail, then pass onto objects
I also created a
Dictionary
eventually I want to compare/catch the bookID and authorID then output it out
an example would be like this below, but the problem is a bit complicated since it has sealed or abstract class which confuse me.
can anyone help me out by using the Dictionary TryGetValue?
Dictionary
float key1 = 10.20f;
char value1 = 'a';
accounts.Add(key1, value1);
char value;
if (accounts.TryGetValue(10.20f, out value))
{
Console.WriteLine("Key {0} is associated with value {1}", 10.20f, value);
}
Console.ReadLine();
Mike GoldPosted Oct 10, 2010, 12:20 AM
if (accounts.ContainsKey(10.20f))
{
Console.WriteLine("Key {0} is associated with value {1}", 10.20f, accounts[10.20f]}
}
Also I would be careful about using floats or doubles as keys. Not sure if its a problem, but you could get a rounding error on the key. You are always better off using integers, longs, or strings.
-Mike