SyndicationItem.Categories Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the syndication categories for the syndication item.
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)
Property Value
A collection of SyndicationCategory objects that represent the categories of the syndication item.
Examples
The following code shows how to add a category to the Categories collection of a SyndicationItem.
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"))
The following XML shows how a SyndicationItem instance with a category is serialized to 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>
The following XML shows how a SyndicationItem instance with a category is serialized to 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>My Item</title>
<description>This is some content</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>
Remarks
When serialized to Atom 1.0 or RSS 2.0, a <category>
element is created for each category in the Categories collection.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應