Rss20ItemFormatter Costruttori

Definizione

Crea una nuova istanza della classe Rss20ItemFormatter.

Overload

Rss20ItemFormatter()

Crea una nuova istanza della classe Rss20ItemFormatter.

Rss20ItemFormatter(SyndicationItem)

Crea una nuova istanza della classe Rss20ItemFormatter.

Rss20ItemFormatter(Type)

Crea una nuova istanza della classe Rss20ItemFormatter.

Rss20ItemFormatter(SyndicationItem, Boolean)

Crea una nuova istanza della classe Rss20ItemFormatter.

Rss20ItemFormatter()

Crea una nuova istanza della classe Rss20ItemFormatter.

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

Si applica a

Rss20ItemFormatter(SyndicationItem)

Crea una nuova istanza della classe Rss20ItemFormatter.

public:
 Rss20ItemFormatter(System::ServiceModel::Syndication::SyndicationItem ^ itemToWrite);
public Rss20ItemFormatter (System.ServiceModel.Syndication.SyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Rss20ItemFormatter : System.ServiceModel.Syndication.SyndicationItem -> System.ServiceModel.Syndication.Rss20ItemFormatter
Public Sub New (itemToWrite As SyndicationItem)

Parametri

itemToWrite
SyndicationItem

SyndicationItem da serializzare.

Esempio

Nell'esempio seguente viene illustrato come chiamare questo costruttore.

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

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

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

Si applica a

Rss20ItemFormatter(Type)

Crea una nuova istanza della classe Rss20ItemFormatter.

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

Parametri

itemTypeToCreate
Type

Istanza derivata da SyndicationItem da associare a Rss20ItemFormatter

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare questo costruttore.

Rss20ItemFormatter myItemRssFormatter = new Rss20ItemFormatter(typeof(MySyndicationItem));
XmlReader rssReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items");
myItemRssFormatter.ReadFrom(rssReader);
rssReader.Close();

Commenti

Utilizzare questo costruttore per specificare una classe derivata da SyndicationItem per creare un'istanza durante la lettura di un elemento di diffusione.

Si applica a

Rss20ItemFormatter(SyndicationItem, Boolean)

Crea una nuova istanza della classe Rss20ItemFormatter.

public:
 Rss20ItemFormatter(System::ServiceModel::Syndication::SyndicationItem ^ itemToWrite, bool serializeExtensionsAsAtom);
public Rss20ItemFormatter (System.ServiceModel.Syndication.SyndicationItem itemToWrite, bool serializeExtensionsAsAtom);
new System.ServiceModel.Syndication.Rss20ItemFormatter : System.ServiceModel.Syndication.SyndicationItem * bool -> System.ServiceModel.Syndication.Rss20ItemFormatter
Public Sub New (itemToWrite As SyndicationItem, serializeExtensionsAsAtom As Boolean)

Parametri

itemToWrite
SyndicationItem

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.

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

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

Dim rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter = New Rss20ItemFormatter(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