Question:You need to serialize an object of type List<int> in a binary format. The object is named data. Which code segment should you use? 

A BinaryFormatter= formatter = gcnew BinaryFormatter(); MemoryStream= stream = gcnew MemoryStream();
formatter->Serialize(stream, data); 

B BinaryFormatter= formatter = gcnew BinaryFormatter(); MemoryStream= stream = gcnew MemoryStream();
Capture c(formatter,stream);
data->ForEach(gcnew Action<int>(%c,&Capture::Action)); 

C BinaryFormatter= formatter = gcnew BinaryFormatter();a rray<Byte>= buffer = gcnew array<Byte>(data->Count); MemoryStream= stream = gcnew MemoryStream(buffer, true); formatter->Serialize(stream, data); 

D BinaryFormatter= formatter = gcnew BinaryFormatter(); MemoryStream= stream = gcnew MemoryStream();
for (int i = 0; i < data->Count; i++) {

formatter->Serialize(stream, data[i]);
} 

+ Answer
+ Report
Total Preview: 985

Copyright © 2024. Powered by Intellect Software Ltd