共用方式為


Rss20ItemFormatter<TSyndicationItem> 建構函式

定義

建立 Rss20ItemFormatter<TSyndicationItem> 類別的新執行個體。

多載

Rss20ItemFormatter<TSyndicationItem>()

建立 Rss20ItemFormatter<TSyndicationItem> 類別的新執行個體。

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

使用指定的 Rss20ItemFormatter<TSyndicationItem> 衍生執行個體,建立 SyndicationItem 類別的新執行個體。

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

使用指定的 Rss20ItemFormatter<TSyndicationItem> 衍生執行個體,建立 SyndicationItem 類別的新執行個體。

Rss20ItemFormatter<TSyndicationItem>()

來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs

建立 Rss20ItemFormatter<TSyndicationItem> 類別的新執行個體。

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

適用於

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs

使用指定的 Rss20ItemFormatter<TSyndicationItem> 衍生執行個體,建立 SyndicationItem 類別的新執行個體。

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)

參數

itemToWrite
TSyndicationItem

要序列化的 SyndicationItem

範例

下列範例將示範如何呼叫這個建構函式。

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)

適用於

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs
來源:
Rss20ItemFormatter.cs

使用指定的 Rss20ItemFormatter<TSyndicationItem> 衍生執行個體,建立 SyndicationItem 類別的新執行個體。

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)

參數

itemToWrite
TSyndicationItem

要序列化的 SyndicationItem

serializeExtensionsAsAtom
Boolean

一個值,指定是否要序列化在 Atom 1.0 規格中已定義,但在 RSS 2.0 規格中並未定義的項目。 預設值是 true

範例

下列範例將示範如何呼叫這個建構函式。

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)

備註

如果 serializeExtensionsAsAtom 參數為 true,則會使用 Atom 1.0 命名空間序列化在 Atom 1.0 規格中已定義,但是在 RSS 2.0 規格中未定義的所有項目。

適用於