nerdexam
Microsoft

70-513 · Question #68

You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows: [DataContract(Namespace = ''] public class Item { } [ServiceContract(Namespace = '')]…

The correct answer is A. DataContractSerializer s = new DataContractSerializer(typeof(Item)). See the full explanation below for the reasoning.

Question

You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows:

[DataContract(Namespace = ''] public class Item { } [ServiceContract(Namespace = '')] public interface Catalog { [OperationContract] [WebInvoke(Method="POST", UriTemplate="{Item}")] Item UpdateItem(Item item); } The client application receives a WebResponse named response with the response from the service. You need to deserialize this response into a strongly typed object representing the return value of the method. Which code segment should you use?

Options

  • ADataContractSerializer s = new DataContractSerializer(typeof(Item));
  • BBinaryFormatter f = new BinaryFormatter();
  • CXmlDictionaryReader r = JsonReaderWriterFactory.CreateJsonReader(
  • DDataContractJsonSerializer s = new DataContractJsonSerializer

How the community answered

(59 responses)
  • A
    75% (44)
  • B
    8% (5)
  • C
    3% (2)
  • D
    14% (8)

Community Discussion

No community discussion yet for this question.

Full 70-513 Practice