Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Rss20FeedFormatter.WriteTo Method

Writes the SyndicationFeed associated with the Rss20FeedFormatter to the specified XmlWriter.

Namespace:  System.ServiceModel.Syndication
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public override void WriteTo(
	XmlWriter writer
)

Parameters

writer
Type: System.Xml.XmlWriter

The XmlWriter to write to.

The following code shows how to create a syndication feed and use a Rss20FeedFormatter to write the feed to an XmlWriter.

            SyndicationFeed feed = new SyndicationFeed("Test Feed", "This is a test feed", new Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now);
            SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now);

	    List<SyndicationItem> items = new List<SyndicationItem>();
	    items.Add(item);
            feed.Items = items;

            XmlWriter rssWriter = XmlWriter.Create("RSS.xml");
            Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
            rssFormatter.WriteTo(rssWriter);
            rssWriter.Close();

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft