Share via


SyndicationFeed.Categories 屬性

定義

取得摘要分類的集合。

public:
 property System::Collections::ObjectModel::Collection<System::ServiceModel::Syndication::SyndicationCategory ^> ^ Categories { System::Collections::ObjectModel::Collection<System::ServiceModel::Syndication::SyndicationCategory ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.ServiceModel.Syndication.SyndicationCategory> Categories { get; }
member this.Categories : System.Collections.ObjectModel.Collection<System.ServiceModel.Syndication.SyndicationCategory>
Public ReadOnly Property Categories As Collection(Of SyndicationCategory)

屬性值

表示摘要分類的 SyndicationCategory 物件集合。

範例

下列程式碼會示範如何將分類加入至 CategoriesSyndicationFeed 集合。

SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);
feed.Categories.Add(new SyndicationCategory("MyFeedCategory"));
Dim feed As New SyndicationFeed("Feed Title", "Feed Description", New Uri("http:'Feed/Alternate/Link"), "FeedID", DateTime.Now)
feed.Categories.Add(New SyndicationCategory("MyFeedCategory"))

下列 XML 會說明 Categories 集合如何序列化為 Atom 1.0。

<category term="FeedCategory" label="CategoryLabel" scheme="CategoryScheme" />

下列 XML 會說明 Categories 集合如何序列化為 RSS 2.0。

<category domain="CategoryScheme">FeedCategory</category>

備註

序列化為 Atom 1.0 時, SyndicationCategory 集合中的每個專案都會寫入 <category> 元素。

序列化為 RSS 2.0 時, SyndicationCategory 集合中的每個專案都會寫入 <category> 元素。

適用於