SyndicationItem 類別

定義

代表摘要項目,例如 RSS <item> 或 Atom <entry>Represents a feed item, for example an RSS <item> or an Atom <entry>.

public ref class SyndicationItem
public class SyndicationItem
type SyndicationItem = class
Public Class SyndicationItem
繼承
SyndicationItem

範例

下列程式碼會示範如何使用 SyndicationItem 類別。The following code shows how to use the SyndicationItem class.

SyndicationItem item = new SyndicationItem("My Item", "This is some content", new Uri("http://SomeServer/MyItem"), "Item ID", DateTime.Now);
item.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
item.Categories.Add(new SyndicationCategory("Category One"));
item.Contributors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://contoso/lene"));
item.Copyright = new TextSyndicationContent("Copyright 2007");
item.Links.Add(new SyndicationLink(new Uri("http://OtherServer/Item"), "alternate", "Alternate Link", "text/html", 1000));
item.PublishDate = new DateTime(2007, 2, 23);
item.Summary = new TextSyndicationContent("this is a summary for my item");
XmlQualifiedName xqName = new XmlQualifiedName("itemAttrib", "http://FeedServer/tags");
item.AttributeExtensions.Add(xqName, "ItemAttribValue");

SyndicationFeed feed = new SyndicationFeed();
Collection<SyndicationItem> items = new Collection<SyndicationItem>();
items.Add(item);
feed.Items = items;
Dim item As SyndicationItem = New SyndicationItem("My Item", "This is some content", New Uri("http:' SomeServer/MyItem"), "Item ID", DateTime.Now)
item.Authors.Add(New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:' contoso/jesper"))
item.Categories.Add(New SyndicationCategory("Category One"))
item.Contributors.Add(New SyndicationPerson("lene@contoso.com", "Lene Aaling", "http:' contoso/lene"))
item.Copyright = New TextSyndicationContent("Copyright 2007")
item.Links.Add(New SyndicationLink(New Uri("http:' OtherServer/Item"), "alternate", "Alternate Link", "text/html", 1000))
item.PublishDate = New DateTime(2007, 2, 23)
item.Summary = New TextSyndicationContent("this is a summary for my item")
Dim xqName As XmlQualifiedName = New XmlQualifiedName("itemAttrib", "http:' FeedServer/tags")
item.AttributeExtensions.Add(xqName, "ItemAttribValue")

Dim feed As SyndicationFeed = New SyndicationFeed()
Dim items As Collection(Of SyndicationItem) = New Collection(Of SyndicationItem)()
items.Add(item)
feed.Items = items

備註

當序列化至 Atom 1.0 時,會將 SyndicationItem 執行個體寫入 <entry> 項目。When serialized to Atom 1.0, a SyndicationItem instance is written to an <entry> element. 下列表格說明,為 SyndicationItem 定義的每個屬性如何針對 Atom 1.0 進行序列化。The following table shows how each property defined for SyndicationItem is serialized for Atom 1.0.

SyndicationItem 屬性SyndicationItem property 已序列化的格式Serialized form
AttributeExtensions <entry> 項目中的屬性。Attribute in the <entry> element.
Authors 集合中每位作者都有一個 <author> 項目。An <author> element for each author in the collection.
Categories <category> 元素。A<category> element.
Content <content> 元素。A<content> element.
Contributors 集合中每個參與者的<contributor> 元素。A<contributor> element for each contributor in the collection.
Copyright <rights> 元素。A<rights> element.
ElementExtensions <entry> 項目中的項目。Element in the <entry> element.
Id <id> 項目。An <id> element.
LastUpdatedTime <updated> 項目。An <updated> element.
Links 集合中的每個連結都有一個 <link> 項目。A <link> element for each link in the collection.
PublishDate <published> 項目。A <published> element.
SourceFeed <source> 項目。A <source> element.
Summary <summary> 項目。A <summary> element.
Title <title> 項目。A <title> element.

當序列化至 RSS 2.0 時,會將 SyndicationItem 執行個體寫入 <item> 項目。When serialized to RSS 2.0, a SyndicationItem instance is written to an <item> element. 下列表格說明,為 SyndicationItem 定義的每個屬性如何針對 RSS 2.0 進行序列化。The following table shows how each property defined for SyndicationItem is serialized for RSS 2.0.

SyndicationItem 屬性SyndicationItem property 已序列化的格式Serialized form
AttributeExtensions <item> 項目中的屬性。Attribute in the <item> element.
Authors 如果 <managingEditor> 集合中只有一個 SyndicationPerson 時,即為 Authors;否則為集合中每位作者的 <a10:author> 項目。A <managingEditor> if only one SyndicationPerson is in the Authors collection; otherwise, the <a10:author> element for each author in the collection.
Categories <category> 項目。A <category> element.
Content <a10:content> 項目。An <a10:content> element.
Contributors <a10:contributor> 集合中每個 SyndicationPerson 都有一個 Contributors 項目。An <a10:contributor> element for each SyndicationPerson in the Contributors collection.
Copyright <copyright> 項目。A <copyright> element.
ElementExtensions <item> 項目中的項目。Element in the <item> element.
Id <a10:id> 項目。An <a10:id> element.
LastUpdatedTime <a10:updated> 項目。An <a10:updated> element.
Links <link> 集合中的每個 SyndicationLink 都有一個 Links 項目。A <link> element for each SyndicationLink in the Links collection.
PublishDate <pubDate> 項目。A <pubDate> element.
SourceFeed <source> 項目。A <source> element.
Summary <description> 項目。A <description> element.
Title <title> 項目。A <title> element.

建構函式

SyndicationItem()

初始化 SyndicationItem 類別的新執行個體。Initializes a new instance of the SyndicationItem class.

SyndicationItem(String, String, Uri)

使用指定的標題、內容和連結,初始化 SyndicationItem 類別的新執行個體。Initializes a new instance of the SyndicationItem class with the specified title, content, and link.

SyndicationItem(String, String, Uri, String, DateTimeOffset)

初始化 SyndicationItem 類別的新執行個體。Initializes a new instance of the SyndicationItem class.

SyndicationItem(String, SyndicationContent, Uri, String, DateTimeOffset)

初始化 SyndicationItem 類別的新執行個體。Initializes a new instance of the SyndicationItem class.

SyndicationItem(SyndicationItem)

使用指定的 SyndicationItem 執行個體,初始化 SyndicationItem 類別的新執行個體。Initializes a new instance of the SyndicationItem class with the specified SyndicationItem instance.

屬性

AttributeExtensions

取得新聞訂閱項目的屬性延伸。Gets the attribute extensions for the syndication item.

Authors

取得新聞訂閱項目的作者。Gets the authors of the syndication item.

BaseUri

取得或設定 SyndicationItem 執行個體的基底統一資源識別項 (URI)。Gets or sets the base Uniform Resource Identifier (URI) for the SyndicationItem instance.

Categories

取得新聞訂閱項目的新聞訂閱分類。Gets the syndication categories for the syndication item.

Content

取得或設定新聞訂閱項目的內容。Gets or sets the content of the syndication item.

Contributors

取得新聞訂閱項目的參與者。Gets the contributors of the syndication item.

Copyright

取得或設定新聞訂閱項目的著作權資訊。Gets or sets the copyright information for the syndication item.

ElementExtensions

取得新聞訂閱項目中所包含的項目延伸。Gets the element extensions contained in the syndication item.

Id

取得或設定新聞訂閱項目的識別碼。Gets or sets the ID of the syndication item.

LastUpdatedTime

取得或設定新聞訂閱項目的上次更新時間。Gets or sets the last updated time for the syndication item.

Links

取得新聞訂閱項目包含的連結。Gets the links contained in the syndication item.

PublishDate

取得或設定新聞訂閱項目的發佈日期。Gets or sets the publish date for the syndication item.

SourceFeed

取得或設定新聞訂閱項目的來源摘要。Gets or sets the source feed of the syndication item.

Summary

取得或設定新聞訂閱項目的摘要。Gets or sets the summary of the syndication item.

Title

取得或設定新聞訂閱項目的標題。Gets or sets the title of the syndication item.

方法

AddPermalink(Uri)

permalink 加入至 SyndicationItemAdds a permalink to the SyndicationItem.

Clone()

建立 SyndicationItem 執行個體的複本。Creates a copy of the SyndicationItem instance.

CreateCategory()

建立新分類。Creates a new category.

CreateLink()

建立新的 SyndicationLink 執行個體。Creates a new SyndicationLink instance.

CreatePerson()

建立新的個人。Creates a new person.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetAtom10Formatter()

取得 Atom10FeedFormatter 執行個體。Gets an Atom10FeedFormatter instance.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetRss20Formatter()

取得 Rss20FeedFormatter 執行個體。Gets an Rss20FeedFormatter instance.

GetRss20Formatter(Boolean)

取得 Rss20FeedFormatter 執行個體。Gets an Rss20FeedFormatter instance.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
Load(XmlReader)

自指定的 SyndicationItem 載入 XmlReader 執行個體。Loads a SyndicationItem instance from the specified XmlReader.

Load<TSyndicationItem>(XmlReader)

自指定的 SyndicationItem 載入 XmlReader 衍生物件。Loads a SyndicationItem derived object from the specified XmlReader.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
SaveAsAtom10(XmlWriter)

以 Atom 1.0 格式將新聞訂閱項目寫入指定的 XmlWriterWrite the syndication item to the specified XmlWriter in Atom 1.0 format.

SaveAsRss20(XmlWriter)

以 RSS 2.0 格式將新聞訂閱項目寫入指定的 XmlWriterWrite the syndication item to the specified XmlWriter in RSS 2.0 format.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TryParseAttribute(String, String, String, String)

嘗試剖析屬性延伸。Attempts to parse an attribute extension.

TryParseContent(XmlReader, String, String, SyndicationContent)

嘗試剖析內容。Attempts to parse content.

TryParseElement(XmlReader, String)

嘗試剖析項目延伸。Attempts to parse an element extension.

WriteAttributeExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將屬性延伸寫入指定的 XmlWriterWrites the attribute extensions to the specified XmlWriter using the specified syndication version.

WriteElementExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將項目延伸寫入至指定的 XmlWriterWrites the element extensions to the specified XmlWriter using the specific syndication version.

適用於