SyndicationItem.AttributeExtensions 屬性

定義

取得新聞訂閱項目的屬性延伸。

public:
 property System::Collections::Generic::Dictionary<System::Xml::XmlQualifiedName ^, System::String ^> ^ AttributeExtensions { System::Collections::Generic::Dictionary<System::Xml::XmlQualifiedName ^, System::String ^> ^ get(); };
public System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName,string> AttributeExtensions { get; }
member this.AttributeExtensions : System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName, string>
Public ReadOnly Property AttributeExtensions As Dictionary(Of XmlQualifiedName, String)

屬性值

字典,其中包含屬性延伸的集合。

範例

下列程式碼會示範如何將屬性延伸加入至新聞訂閱摘要。

SyndicationItem item = new SyndicationItem();
item.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");
Dim item As New SyndicationItem()
item.AttributeExtensions.Add(New XmlQualifiedName("myAttribute", ""), "someValue")

下列 XML 程式碼會示範包含稱為 SyndicationItem 的自訂屬性之 itemAttrib 執行個體的 Atom 1.0 序列化。

<link rel="alternate" href="http://someserver/MyItem" />
<content type="text">This is some content</content>

下列程式碼顯示序列化為 RSS 2.0 的相同 SyndicationItem 執行個體。

<item p4:itemAttrib="ItemAttribValue" xmlns:p4="http://FeedServer/tags">
  <link>http://someserver/MyItem</link>
  <link>http://alternate/Link</link>
  <source>MyFeed</source>
  <link>http://someserver/MyItem</link>
  <author>jesper@contoso.com</author>
  <description>this is a summary for my item</description>
  <a10:content type="text">This is some content</a10:content>
</item>

備註

新聞訂閱物件模型允許您新增自訂屬性至 SyndicationItem 執行個體。 當為 Atom 1.0 序列化時,會將自訂屬性寫入 <entry> 項目。 當為 RSS 2.0 序列化時,會將自訂屬性寫入 <item> 項目。 如需示範如何新增屬性延伸的完整範例,請參閱 鬆散類型延伸模組 範例。

適用於