Question:You have recently written the code shown below:
Dim emailAddresses As New Hashtable()
emailAddresses.Add("Mia", "mia@ Certkiller .com")
emailAddresses.Add("Andy", "andy@ Certkiller .com")
emailAddresses.Add("Kara", "kara@ Certkiller .com")
Dim stream As New FileStream("Email.dat", FileMode.Create)
Dim formatter As New BinaryFormatter()
formatter.Serialize(stream, emailAddresses)
You need to ensure that you are able to load the emailAddresses object from the Email.dat file
into your
application.
What should you do? - (VB.NET) 

A Use the following code:
Dim readStream As New FileStream("Email.dat", FileMode.Open)
Dim loadEmails As HashTable = readStream.Deserialize() 

B Use the following code:
Dim readStream As New FileStream("Email.dat", FileMode.Open)
Dim readFormatter As New BinaryFormatter()
Dim loadEmails As HashTable = readFormatter.Deserialize(readStream) 

C Use the following code:
Dim readStream As New FileStream("Email.dat", FileMode.Open)
Dim readFormatter As New BinaryFormatter()
Dim loadEmails As HashTable = DirectCast(readFormatter.Deserialize(readStream),
HashTable) 

D Use the following code:
Dim readStream As New FileStream("Email.dat", FileMode.Open)
Dim loadEmails As HashTable = DirectCast(readFormatter.ReadObject(), HashTable) 

+ Answer
+ Report
Total Preview: 842

Copyright © 2024. Powered by Intellect Software Ltd