You are developing an application. The application converts a Location object to a string by using a
method named WriteObject. The WriteObject() method accepts two parameters, a Location object and an
XmlObjectSerializer object.
The application includes the following code. (Line numbers are included for reference only.)
You need to serialize the Location object as a JSONobject.
Which code segment should you insert at line 20?
A.
New DataContractSerializer(typeof(Location))
B.
New XmlSerializer(typeof(Location))
C.
New NetBataContractSenalizer {}
D.
New CataConcractJsonSerializer(typeof(Location))
Its DataContractJsonSerializer instead of CataContractJsonSerializer.
Its DataContractJsonSerializer instead of DataContractSerializer.
Answer would be letter A.
I agree
D
A
Only DataContractSerializer is a XmlObjectSerializer
Not true, DataContractJsonSerializer is also an XmlObjectSerializer.
See: https://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer(v=vs.110).aspx
D