you have recently written the code shown below:
Hashtable emailAddresses = new Hashtable ();
emailAddresses.Add (“Mia”, “mia@ Domain.com”);
emailAddresses.Add (“Andy”, “andy@ Domain.com”);
emailAddresses.Add (“Kara”, “kara@ Domain.com”);
You need to ensure that these e-mail addresses are stored in the Email.dat file so that you can load them again
when the user restarts the application.
What should you do?
A.
Add the following code:
FileStream stream = new FileStream (“Email.dat”, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter ();
formatter.Deserialize(stream, emailAddresses);
B.
Add the following code:
FileStream stream = new FileStream (“Email.dat”, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter ();
formatter.Serialize(stream, emailAddresses);
C.
Add the following code:
FileStream stream = new FileStream (“Email.dat”, FileMode.Create);
stream.Serialize(emailAddresses);
D.
Add the following code:
FileStream stream = new FileStream (“Email.dat”, FileMode.Create);
stream.WriteObject(emailAddresses);
I choose B