SyndicationItem.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)

プロパティ値

Collection<SyndicationCategory>

配信項目のカテゴリを表す SyndicationCategory オブジェクトのコレクション。

CategoriesSyndicationItem コレクションにカテゴリを追加する方法を次のコードに示します。

SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"));
item.Categories.Add(new SyndicationCategory("MyFeedCategory"));
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"))
item.Categories.Add(New SyndicationCategory("MyFeedCategory"))

次の XML は、カテゴリを持った SyndicationItem インスタンスが Atom 1.0 にシリアル化される方法を示します。

<entry>
  <id>Item ID</id>
  <title type="text">My Item</title>
  <updated>2007-03-16T23:02:54Z</updated>
  <author>
    <name>Jesper Aaberg</name>
    <uri>http://contoso/Jesper</uri>
    <email>jesper@contoso.com</email>
  </author>
  <link rel="alternate" href="http://someserver/MyItem" />
  <link rel="alternate" type="text/html" title="Alternate Link" length="1000" href="http://otherserver/Item" />
  <category term="Category One" />
  <content type="text">This is some content</content>
</entry>

次の XML は、カテゴリを持った SyndicationItem インスタンスが RSS 2.0 にシリアル化される方法を示します。

<item>
  <guid isPermaLink="false">Item ID</guid>
  <link>http://someserver/MyItem</link>
  <author>lene@contoso.com</author>
  <category>Category One</category>
  <title>マイ アイテム</title>

  <description>これはいくつかのコンテンツです</description>
  <a10:link rel="alternate" type="text/html" title="Alternate Link" length="1000" href="http://otherserver/Item" />
  <a10:updated>2007-03-16T23:02:54Z</a10:updated>
</item>

注釈

Atom 1.0 または RSS 2.0 にシリアル化する場合、<category> コレクション内の各カテゴリについて Categories 要素が作成されます。

適用対象