Upravit

Sdílet prostřednictvím


Rss20FeedFormatter Constructors

Definition

Creates a new instance of the Rss20FeedFormatter class.

Overloads

Rss20FeedFormatter()

Creates a new instance of the Rss20FeedFormatter class.

Rss20FeedFormatter(SyndicationFeed)

Creates a new instance of the Rss20FeedFormatter class with the specified SyndicationFeed instance.

Rss20FeedFormatter(Type)

Creates a new instance of the Rss20FeedFormatter class.

Rss20FeedFormatter(SyndicationFeed, Boolean)

Creates a new instance of the Rss20FeedFormatter class with the specified SyndicationFeed instance.

Rss20FeedFormatter()

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter class.

public:
 Rss20FeedFormatter();
public Rss20FeedFormatter ();
Public Sub New ()

Examples

The following code shows how to create an Rss20FeedFormatter instance and read in an RSS syndication feed.

XmlReader rssReader = XmlReader.Create("http://contoso/Feeds/RSS/MyFeed");
Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter();
rssFormatter.ReadFrom(rssReader);
rssReader.Close();
Dim rssReader As XmlReader = XmlReader.Create("http://contoso/Feeds/RSS/MyFeed")
Dim rssFormatter As New Rss20FeedFormatter()
rssFormatter.ReadFrom(rssReader)
rssReader.Close()

Applies to

Rss20FeedFormatter(SyndicationFeed)

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter class with the specified SyndicationFeed instance.

public:
 Rss20FeedFormatter(System::ServiceModel::Syndication::SyndicationFeed ^ feedToWrite);
public Rss20FeedFormatter (System.ServiceModel.Syndication.SyndicationFeed feedToWrite);
new System.ServiceModel.Syndication.Rss20FeedFormatter : System.ServiceModel.Syndication.SyndicationFeed -> System.ServiceModel.Syndication.Rss20FeedFormatter
Public Sub New (feedToWrite As SyndicationFeed)

Parameters

feedToWrite
SyndicationFeed

The SyndicationFeed to serialize.

Examples

The following example shows how to call this constructor.

    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);
Dim feed As SyndicationFeed = New SyndicationFeed("Test Feed", "This is a test feed", New Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now)
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now)

Dim items As List(Of SyndicationItem) = New List(Of SyndicationItem)()
items.Add(item)
feed.Items = items

Dim rssWriter As XmlWriter = XmlWriter.Create("RSS.xml")
Dim rssFormatter As Rss20FeedFormatter = New Rss20FeedFormatter(feed)

Applies to

Rss20FeedFormatter(Type)

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter class.

public:
 Rss20FeedFormatter(Type ^ feedTypeToCreate);
public Rss20FeedFormatter (Type feedTypeToCreate);
new System.ServiceModel.Syndication.Rss20FeedFormatter : Type -> System.ServiceModel.Syndication.Rss20FeedFormatter
Public Sub New (feedTypeToCreate As Type)

Parameters

feedTypeToCreate
Type

The instance derived from SyndicationFeed to be serialized.

Examples

The following code shows how to use this constructor.

Rss20FeedFormatter myFeedRssFormatter = new Rss20FeedFormatter(typeof(MySyndicationFeed));
XmlReader rssReader = XmlReader.Create("http://Contoso/Feeds/MyFeed");
myFeedRssFormatter.ReadFrom(rssReader);
rssReader.Close();
Dim myFeedRssFormatter As New Rss20FeedFormatter(GetType(MySyndicationFeed))
Dim rssReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed")
myFeedRssFormatter.ReadFrom(rssReader)
rssReader.Close()

Remarks

Use this constructor to specify a class derived from SyndicationFeed to instantiate when a syndication feed is read in.

Applies to

Rss20FeedFormatter(SyndicationFeed, Boolean)

Source:
Rss20FeedFormatter.cs
Source:
Rss20FeedFormatter.cs

Creates a new instance of the Rss20FeedFormatter class with the specified SyndicationFeed instance.

public:
 Rss20FeedFormatter(System::ServiceModel::Syndication::SyndicationFeed ^ feedToWrite, bool serializeExtensionsAsAtom);
public Rss20FeedFormatter (System.ServiceModel.Syndication.SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom);
new System.ServiceModel.Syndication.Rss20FeedFormatter : System.ServiceModel.Syndication.SyndicationFeed * bool -> System.ServiceModel.Syndication.Rss20FeedFormatter
Public Sub New (feedToWrite As SyndicationFeed, serializeExtensionsAsAtom As Boolean)

Parameters

feedToWrite
SyndicationFeed

The SyndicationFeed 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 value is true.

Examples

The following example shows how to call this constructor.

    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, true);
Dim feed As SyndicationFeed = New SyndicationFeed("Test Feed", "This is a test feed", New Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now)
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now)

Dim items As List(Of SyndicationItem) = New List(Of SyndicationItem)()
items.Add(item)
feed.Items = items

Dim rssWriter As XmlWriter = XmlWriter.Create("RSS.xml")
Dim rssFormatter As Rss20FeedFormatter = New Rss20FeedFormatter(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 in the Atom 1.0 namespace.

Applies to