Rss20FeedFormatter<TSyndicationFeed> Construtores

Definição

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed>.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class.

Sobrecargas

Rss20FeedFormatter<TSyndicationFeed>()

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed>.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class.

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed)

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed> com a instância derivada de SyndicationFeed especificada.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed, Boolean)

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed> com a instância derivada de SyndicationFeed especificada.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

Rss20FeedFormatter<TSyndicationFeed>()

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed>.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class.

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

Aplica-se a

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed)

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed> com a instância derivada de SyndicationFeed especificada.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

public:
 Rss20FeedFormatter(TSyndicationFeed feedToWrite);
public Rss20FeedFormatter (TSyndicationFeed feedToWrite);
new System.ServiceModel.Syndication.Rss20FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))> : 'SyndicationFeed -> System.ServiceModel.Syndication.Rss20FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))>
Public Sub New (feedToWrite As TSyndicationFeed)

Parâmetros

feedToWrite
TSyndicationFeed

O feed a serializar.The feed to serialize.

Exemplos

O exemplo a seguir mostra como chamar esse construtor.The following example shows how to call this constructor.

           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);
Dim feed As MySyndicationFeed = New MySyndicationFeed("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)

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

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(Of MySyndicationFeed) = New Rss20FeedFormatter(Of MySyndicationFeed)(feed)

Aplica-se a

Rss20FeedFormatter<TSyndicationFeed>(TSyndicationFeed, Boolean)

Cria uma nova instância da classe Rss20FeedFormatter<TSyndicationFeed> com a instância derivada de SyndicationFeed especificada.Creates a new instance of the Rss20FeedFormatter<TSyndicationFeed> class with the specified SyndicationFeed derived instance.

public:
 Rss20FeedFormatter(TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom);
public Rss20FeedFormatter (TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom);
new System.ServiceModel.Syndication.Rss20FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))> : 'SyndicationFeed * bool -> System.ServiceModel.Syndication.Rss20FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))>
Public Sub New (feedToWrite As TSyndicationFeed, serializeExtensionsAsAtom As Boolean)

Parâmetros

feedToWrite
TSyndicationFeed

O feed a serializar.The feed to serialize.

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.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. O padrão é true.The default is true.

Exemplos

O exemplo a seguir mostra como chamar esse construtor.The following example shows how to call this constructor.

           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);
Dim feed As MySyndicationFeed = New MySyndicationFeed("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)

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

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(Of MySyndicationFeed) = New Rss20FeedFormatter(Of MySyndicationFeed)(feed, True)

Comentários

Se o serializeExtensionsAsAtom parâmetro for true , todos os elementos definidos na especificação Atom 1,0 que não estiverem definidos na especificação RSS 2,0 serão serializados com o namespace Atom 1,0.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.

Aplica-se a