Which code segment should you insert at line 04?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment for the service implementation. (Line numbers are included for reference only.)

01 public void PutMessage(Message msg)
02 {
03 string value=null;
05 }

You need to retrieve the content from the received message body and store it in the variable named value. Which code segment should you insert at line 04?

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment for the service implementation. (Line numbers are included for reference only.)

01 public void PutMessage(Message msg)
02 {
03 string value=null;
05 }

You need to retrieve the content from the received message body and store it in the variable named value. Which code segment should you insert at line 04?

A.
value=msg.GetBody<string>();

B.
string ns=msg.Headers.GetHeader<string>(0);
value=msg.GetBodyAttribute(“Body”, ns);

C.
XmlReader reader=msg.GetBody<XmlReader>();
value=reader.ReadOuterXml();

D.
XmlReader reader=msg.GetReaderAtBodyContents();
value=reader.ReadOuterXml();

Explanation:
http://msdn.microsoft.com/en-us/library/ms734675.aspx



Leave a Reply 0

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