Condividi tramite


Rss20ItemFormatter<TSyndicationItem> Costruttori

Definizione

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem>.

Overload

Rss20ItemFormatter<TSyndicationItem>()

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem>.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem> con l'istanza derivata della classe SyndicationItem specificata.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem> con l'istanza derivata della classe SyndicationItem specificata.

Rss20ItemFormatter<TSyndicationItem>()

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem>.

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

Si applica a

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem> con l'istanza derivata della classe SyndicationItem specificata.

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)

Parametri

itemToWrite
TSyndicationItem

SyndicationItem da serializzare.

Esempio

Nell'esempio seguente viene illustrato come chiamare questo costruttore.

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)

Si applica a

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

Crea una nuova istanza della classe Rss20ItemFormatter<TSyndicationItem> con l'istanza derivata della classe SyndicationItem specificata.

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)

Parametri

itemToWrite
TSyndicationItem

SyndicationItem da serializzare.

serializeExtensionsAsAtom
Boolean

Un valore che specifica se serializzare gli elementi definiti nella specifica Atom 1.0, ma non nella specifica RSS 2.0. Il valore predefinito è true.

Esempio

Nell'esempio seguente viene illustrato come chiamare questo costruttore.

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)

Commenti

Se il parametro serializeExtensionsAsAtom è true, tutti gli elementi definiti nella specifica Atom 1.0, ma non nella specifica RSS 2.0, vengono serializzati con lo spazio dei nomi di Atom 1.0.

Si applica a