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 JSON object.
Which code segment should you insert at line 20?

A.
New DataContractSerializer(typeof(Location))
B.
New XmlSerializer(typeof(Location))
C.
New NetDataContractSenalizer()
D.
New DataContractJsonSerializer(typeof(Location))
Explanation:
The DataContractJsonSerializer class serializes objects to the JavaScript Object Notation
(JSON) and deserializes JSON data to objects.
Use the DataContractJsonSerializer class to serialize instances of a type into a JSON
document and to deserialize a JSON document into an instance of a type.
Ans. D
0
0
A is the correct answer!
0
0
Why A?
I think is D.
DataContractJsonSerializer extends XmlObjectSerializer as MSDN says.
0
0
D if you want xml if you want JSON A
0
1
The Question Clearly says: “You need to serialize the Location object as a JSON object.
Which code segment should you insert at line 20?”, so the answer should be D.
0
0