You are troubleshooting an application that uses a class named FullName. The class is decorated with the DataContractAttribute attribute. The application includes the following code. (Line numbers are included for reference only.)
You need to ensure that the entire FullName object is serialized to the memory stream object.
Which code segment should you insert at line 09?
A. binary.WriteEndDocument();
B. binary.WriteEndDocumentAsync();
C. binary.WriteEndElementAsync();
D. binary.Flush();
answer is D… please..
D
the answer is D
from:
https://msdn.microsoft.com/en-us/library/ms752244(v=vs.110).aspx
MemoryStream stream2 = new MemoryStream();
XmlDictionaryWriter binaryDictionaryWriter = XmlDictionaryWriter.CreateBinaryWriter(stream2);
DataContractSerializer serializer = new DataContractSerializer(typeof(Record));
serializer.WriteObject(binaryDictionaryWriter, record1);
binaryDictionaryWriter.Flush();