Which code segment should you use?

You are consuming a Windows Communication Foundation (WCF) service. The service
interface is defined as follows. <DataContract(Namespace:=””)> Public Class Item End
Class ServiceContract (Namespace: =””) > Public Interface ICatalog <OperationContract()>
<WebInvoke(Method:=”POST*’, UriTemplate:=”/Item”) > Function Updateltem(ByVal item
As Item) As Item End Interface 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?

You are consuming a Windows Communication Foundation (WCF) service. The service
interface is defined as follows. <DataContract(Namespace:=””)> Public Class Item End
Class ServiceContract (Namespace: =””) > Public Interface ICatalog <OperationContract()>
<WebInvoke(Method:=”POST*’, UriTemplate:=”/Item”) > Function Updateltem(ByVal item
As Item) As Item End Interface 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?

A.
Dim r As XmlDictionaryReader = JsonReaderUriterFactory.CreateJsonReader(
response.GetResponseStream(), XmlDictionaryReaderQuotas.Max) Dim s As
DataContractSerializer = New DataContractSerializer(GetType(Item) Dim item As Item =
DirectCast(s.ReadObject(r), Item)

B.
Dim s As DataContractSerializer = New DataContractSerializer(GetType(Item)) Dim item
As Item – DirectCast(s.ReadObject(response.GetResponsestrearn()), Item)

C.
Dim s As DataContractJsonSerlalizer = New DataContractJsonSerlalizer( GetType(Item))
Dim item As Item = DirectCast(s.ReadObject( response.GetResponsestrearn()), Item)

D.
Dim f As BinaryFormatter = New BinaryFormatter() Dim item As Item =
DirectCast(f-Deserialize(response.GetResponsestream()), Item)



Leave a Reply 0

Your email address will not be published. Required fields are marked *