PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing an application that retrieves patient data from a web service. The application
stores the JSON messages returned from the web service in a string variable named PatientAsJson.
The variable is encoded as UTF-8. The application includes a class named Patient that is defined by
the following code:

You need to populate the Patient class with the data returned from the web service.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

4 Comments on “Which code segment should you use?

    1. Mike says:

      I agree with you and also say it is A. But the Question is wrong as your link states clearly:
      “1.) Define the data contract for Person by attaching the DataContractAttribute to the class and DataMemberAttribute attribute to the members you want to serialize. For more information about data contracts, see Designing Service Contracts.”




      0



      0
  1. Lord Vader says:

    DataContractJsonSerializer.WriteObject
    Serializes a specified object to JavaScript Object Notation (JSON) data and writes the resulting JSON to a stream.
    we want to read from a stream and write to an object. this reads an object and writes to a stream.

    DataContractJsonSerializer.ReadObject
    Reads a document stream in the JSON (JavaScript Object Notation) format and returns the deserialized object.
    we want to read from a stream and write to an object. bingo

    xmlserializer/binaryformatter cant interpret json so u have garbage data stored in the patient obj




    1



    0

Leave a Reply