Idioma

Rss20FeedFormatter Construtores

Definição

Cria uma nova instância da Rss20FeedFormatter classe.

Sobrecargas

Nome Descrição
Rss20FeedFormatter()

Cria uma nova instância da Rss20FeedFormatter classe.

Rss20FeedFormatter(SyndicationFeed)

Cria uma nova instância da Rss20FeedFormatter classe com a instância especificada SyndicationFeed .

Rss20FeedFormatter(Type)

Cria uma nova instância da Rss20FeedFormatter classe.

Rss20FeedFormatter(SyndicationFeed, Boolean)

Cria uma nova instância da Rss20FeedFormatter classe com a instância especificada SyndicationFeed .

Rss20FeedFormatter()

Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs

Cria uma nova instância da Rss20FeedFormatter classe.

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

Exemplos

O código seguinte mostra como criar uma Rss20FeedFormatter instância e ler num feed de sindicância 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()

Aplica-se a

Rss20FeedFormatter(SyndicationFeed)

Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs

Cria uma nova instância da Rss20FeedFormatter classe com a instância especificada 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)

Parâmetros

feedToWrite
SyndicationFeed

O SyndicationFeed para serializar.

Exemplos

O exemplo seguinte mostra como chamar este construtor.

    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)

Aplica-se a

Rss20FeedFormatter(Type)

Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs

Cria uma nova instância da Rss20FeedFormatter classe.

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

Parâmetros

feedTypeToCreate
Type

A instância derivada de SyndicationFeed será serializada.

Exemplos

O código seguinte mostra como usar este construtor.

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

Observações

Use este construtor para especificar uma classe derivada de SyndicationFeed a instanciar quando um feed de sindicância é lido.

Aplica-se a

Rss20FeedFormatter(SyndicationFeed, Boolean)

Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs
Origem:
Rss20FeedFormatter.cs

Cria uma nova instância da Rss20FeedFormatter classe com a instância especificada 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)

Parâmetros

feedToWrite
SyndicationFeed

O SyndicationFeed para serializar.

serializeExtensionsAsAtom
Boolean

Um valor que especifica se deve serializar elementos definidos na especificação Atom 1.0, mas não na especificação RSS 2.0. O valor predefinido é true.

Exemplos

O exemplo seguinte mostra como chamar este construtor.

    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)

Observações

Se o serializeExtensionsAsAtom parâmetro for true, todos os elementos definidos na especificação Atom 1.0 que não estejam definidos na especificação RSS 2.0 são serializados com no namespace Atom 1.0.

Aplica-se a