PrepAway - Latest Free Exam Questions & Answers

Which two lines of code should ou insert between lines 02 and 03?

A Windows Communication Foundation (WCF) client application is consuming an RSS syndication feed from a blog.
You have a SyndicationFeed variable named feed. The application iterates through the items as follows.
(Line numbers are included for reference only.)

01 foreach (SyndicationItem item in feed.Items)
02 {
03 }

You need to display the content type and body of every syndication item to the console.
Which two lines of code should ou insert between lines 02 and 03?

PrepAway - Latest Free Exam Questions & Answers

A.
ConsoleWriteLine(item.Content.Type);
ConsoleWriteLine(((TextSyndicationContent)item.Content).Text);

B.
Console.WriteLine(item.Content.GetType());
Console.WriteLine(((TextSyndicationContent)item.Content).Text);

C.
Console.WriteLine(item.Content.Type);
Console.WriteLine(item.Content.ToString());

D.
Console.WriteLine(item.Content.GetType());
Console.WriteLine(item.Content.ToString());

Explanation:
SyndicationItem Class Represents a feed item, for example an RSS <item> or an Atom <entry>.
TextSyndicationContent Represents any SyndicationItem content intended to be displayed to an end user. Properties:
AttributeExtensions Gets the attribute extensions for this content. (Inherited from SyndicationContent.)
Text Gets the text of the TextSyndicationContent.
Type Gets the content type of the TextSyndicationContent. (Overrides SyndicationContent.Type.)

SyndicationItem Class
(http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationitem.aspx)

4.1 ATOM 1.0 Formatted Feed
(http://msdn.microsoft.com/en-us/library/ee682805(v=office.12).aspx)

4.2 RSS 2.0 Formatted Feed
(http://msdn.microsoft.com/en-us/library/ee682799(v=office.12).aspx)

One Comment on “Which two lines of code should ou insert between lines 02 and 03?


Leave a Reply