Rss20FeedFormatter<TSyndicationFeed> Constructors

Definition

Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class.

Overloads

Rss20FeedFormatter<TSyndicationFeed>()

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class.

C#
public Rss20FeedFormatter();

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed)

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

C#
public Rss20FeedFormatter(TSyndicationFeed feedToWrite);

Parameters

feedToWrite
TSyndicationFeed

The feed to serialize.

Examples

The following example shows how to call this constructor.

C#
           MySyndicationFeed feed = new MySyndicationFeed("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);

           item.Links.Add(new SyndicationLink(new Uri("http://Contoso"), "alternate", "MyItemLink", "text/html", 100));
           item.PublishDate = new DateTime(1968, 2, 23);
           item.LastUpdatedTime = DateTime.Today;
           item.SourceFeed = feed;
           item.Summary = new TextSyndicationContent("This the item summary");

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

           XmlWriter rssWriter = XmlWriter.Create("Rss.xml");
           Rss20FeedFormatter<MySyndicationFeed> rssFormatter = new Rss20FeedFormatter<MySyndicationFeed>(feed);

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed, Boolean)

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

C#
public Rss20FeedFormatter(TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom);

Parameters

feedToWrite
TSyndicationFeed

The feed to serialize.

serializeExtensionsAsAtom
Boolean

A value that specifies whether to serialize elements that are defined in the Atom 1.0 specification, but not in the RSS 2.0 specification. The default is true.

Examples

The following example shows how to call this constructor.

C#
           MySyndicationFeed feed = new MySyndicationFeed("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);

           item.Links.Add(new SyndicationLink(new Uri("http://Contoso"), "alternate", "MyItemLink", "text/html", 100));
           item.PublishDate = new DateTime(1968, 2, 23);
           item.LastUpdatedTime = DateTime.Today;
           item.SourceFeed = feed;
           item.Summary = new TextSyndicationContent("This the item summary");

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

           XmlWriter rssWriter = XmlWriter.Create("Rss.xml");
           Rss20FeedFormatter<MySyndicationFeed> rssFormatter = new Rss20FeedFormatter<MySyndicationFeed>(feed, true);

Remarks

If the serializeExtensionsAsAtom parameter is true, all elements defined in the Atom 1.0 specification that are not defined in the RSS 2.0 specification are serialized with the Atom 1.0 namespace.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)