Bagikan melalui


Rss20FeedFormatter Konstruktor

Definisi

Membuat instans Rss20FeedFormatter baru kelas.

Overload

Rss20FeedFormatter()

Membuat instans Rss20FeedFormatter baru kelas.

Rss20FeedFormatter(SyndicationFeed)

Membuat instans Rss20FeedFormatter baru kelas dengan instans yang ditentukan SyndicationFeed .

Rss20FeedFormatter(Type)

Membuat instans Rss20FeedFormatter baru kelas.

Rss20FeedFormatter(SyndicationFeed, Boolean)

Membuat instans Rss20FeedFormatter baru kelas dengan instans yang ditentukan SyndicationFeed .

Rss20FeedFormatter()

Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs

Membuat instans Rss20FeedFormatter baru kelas.

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

Contoh

Kode berikut menunjukkan cara membuat Rss20FeedFormatter instans dan membaca di umpan sindikasi RSS.

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()

Berlaku untuk

Rss20FeedFormatter(SyndicationFeed)

Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs

Membuat instans Rss20FeedFormatter baru kelas dengan instans yang ditentukan SyndicationFeed .

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)

Parameter

feedToWrite
SyndicationFeed

yang SyndicationFeed akan diserialisasikan.

Contoh

Contoh berikut menunjukkan cara memanggil konstruktor ini.

    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)

Berlaku untuk

Rss20FeedFormatter(Type)

Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs

Membuat instans Rss20FeedFormatter baru kelas.

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

Parameter

feedTypeToCreate
Type

Instans yang berasal dari SyndicationFeed untuk diserialisasikan.

Contoh

Kode berikut menunjukkan cara menggunakan konstruktor ini.

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()

Keterangan

Gunakan konstruktor ini untuk menentukan kelas yang berasal dari SyndicationFeed untuk membuat instans saat umpan sindikasi dibaca.

Berlaku untuk

Rss20FeedFormatter(SyndicationFeed, Boolean)

Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs
Sumber:
Rss20FeedFormatter.cs

Membuat instans Rss20FeedFormatter baru kelas dengan instans yang ditentukan SyndicationFeed .

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)

Parameter

feedToWrite
SyndicationFeed

yang SyndicationFeed akan diserialisasikan.

serializeExtensionsAsAtom
Boolean

Nilai yang menentukan apakah akan membuat serial elemen yang ditentukan dalam spesifikasi Atom 1.0 tetapi tidak dalam spesifikasi RSS 2.0. Nilai defaultnya adalah true.

Contoh

Contoh berikut menunjukkan cara memanggil konstruktor ini.

    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)

Keterangan

serializeExtensionsAsAtom Jika parameter adalah true, semua elemen yang ditentukan dalam spesifikasi Atom 1.0 yang tidak ditentukan dalam spesifikasi RSS 2.0 diserialisasikan dengan di namespace Atom 1.0.

Berlaku untuk