Rss20ItemFormatter Konstruktorer

Definition

Skapar en ny instans av Rss20ItemFormatter klassen.

Överlagringar

Name Description
Rss20ItemFormatter()

Skapar en ny instans av Rss20ItemFormatter klassen.

Rss20ItemFormatter(SyndicationItem)

Skapar en ny instans av Rss20ItemFormatter klassen.

Rss20ItemFormatter(Type)

Skapar en ny instans av Rss20ItemFormatter klassen.

Rss20ItemFormatter(SyndicationItem, Boolean)

Skapar en ny instans av Rss20ItemFormatter klassen.

Rss20ItemFormatter()

Skapar en ny instans av Rss20ItemFormatter klassen.

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

Gäller för

Rss20ItemFormatter(SyndicationItem)

Skapar en ny instans av Rss20ItemFormatter klassen.

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)

Parametrar

itemToWrite
SyndicationItem

Att SyndicationItem serialisera.

Exempel

I följande exempel visas hur du anropar den här konstruktorn.

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)

Gäller för

Rss20ItemFormatter(Type)

Skapar en ny instans av Rss20ItemFormatter klassen.

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

Parametrar

itemTypeToCreate
Type

Instansen som härleds från SyndicationItem för att associeras med Rss20ItemFormatter.

Exempel

Följande kod visar hur du använder den här konstruktorn.

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

Kommentarer

Använd den här konstruktorn för att ange en klass som härleds från SyndicationItem för att instansiera när ett syndikeringsobjekt läses in.

Gäller för

Rss20ItemFormatter(SyndicationItem, Boolean)

Skapar en ny instans av Rss20ItemFormatter klassen.

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)

Parametrar

itemToWrite
SyndicationItem

Att SyndicationItem serialisera.

serializeExtensionsAsAtom
Boolean

Ett värde som anger om element som definieras i Atom 1.0-specifikationen ska serialiseras men inte i RSS 2.0-specifikationen. Standardvärdet är true.

Exempel

I följande exempel visas hur du anropar den här konstruktorn.

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)

Kommentarer

Om parametern serializeExtensionsAsAtom är trueserialiseras alla element som definieras i Atom 1.0-specifikationen som inte har definierats i RSS 2.0-specifikationen med Atom 1.0-namnområdet.

Gäller för