Rss20ItemFormatter<TSyndicationItem> Construtores

Definição

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem>.

Sobrecargas

Rss20ItemFormatter<TSyndicationItem>()

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem>.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.

Rss20ItemFormatter<TSyndicationItem>()

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem>.

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

Aplica-se a

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.

public:
 Rss20ItemFormatter(TSyndicationItem itemToWrite);
public Rss20ItemFormatter (TSyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> : 'SyndicationItem -> System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))>
Public Sub New (itemToWrite As TSyndicationItem)

Parâmetros

itemToWrite
TSyndicationItem

O SyndicationItem a ser serializado.

Exemplos

O exemplo a seguir mostra como chamar esse construtor.

MySyndicationItem item = new MySyndicationItem("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 = new SyndicationFeed();
item.Summary = new TextSyndicationContent("This the item summary");

XmlWriter rssWriter = XmlWriter.Create("RssItem.xml");
Rss20ItemFormatter<MySyndicationItem> formatter = new Rss20ItemFormatter<MySyndicationItem>(item);
Dim item As MySyndicationItem = New MySyndicationItem("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 = New SyndicationFeed()
item.Summary = New TextSyndicationContent("This the item summary")

Dim rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter(Of MySyndicationItem) = New Rss20ItemFormatter(Of MySyndicationItem)(item)

Aplica-se a

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.

public:
 Rss20ItemFormatter(TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom);
public Rss20ItemFormatter (TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom);
new System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> : 'SyndicationItem * bool -> System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))>
Public Sub New (itemToWrite As TSyndicationItem, serializeExtensionsAsAtom As Boolean)

Parâmetros

itemToWrite
TSyndicationItem

O SyndicationItem a ser serializado.

serializeExtensionsAsAtom
Boolean

Um valor que especifica se elementos que são definidos na especificação do Atom 1.0, mas não na especificação do RSS 2.0, devem ou não ser serializados. O valor padrão é true.

Exemplos

O exemplo a seguir mostra como chamar esse construtor.

MySyndicationItem item = new MySyndicationItem("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 = new SyndicationFeed();
item.Summary = new TextSyndicationContent("This the item summary");

XmlWriter rssWriter = XmlWriter.Create("RssItem.xml");
Rss20ItemFormatter<MySyndicationItem> formatter = new Rss20ItemFormatter<MySyndicationItem>(item, true);
Dim item As MySyndicationItem = New MySyndicationItem("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 = New SyndicationFeed()
item.Summary = New TextSyndicationContent("This the item summary")

Dim rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter(Of MySyndicationItem) = New Rss20ItemFormatter(Of MySyndicationItem)(item, True)

Comentários

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

Aplica-se a