SyndicationItem.AttributeExtensions Egenskap

Definition

Hämtar attributtilläggen för syndikeringsobjektet.

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)

Egenskapsvärde

En ordlista som innehåller en samling attributtillägg.

Exempel

Följande kod visar hur du lägger till ett attributtillägg i en syndikeringsfeed.

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

Följande XML-kod visar en Atom 1.0-serialisering av en SyndicationItem instans med ett anpassat attribut med namnet itemAttrib.

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

Följande kod visar samma SyndicationItem instans serialiserad som RSS 2.0.

<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>

Kommentarer

Med objektmodellen Syndication kan du lägga till anpassade attribut i en SyndicationItem instans. När det serialiseras för Atom 1.0 skrivs det anpassade attributet till ett <entry> element. När det serialiseras för RSS 2.0 skrivs det anpassade attributet till ett <item> element. Ett fullständigt exempel som visar hur du lägger till ett attributtillägg finns i exemplet Loosely-Typed Tillägg .

Gäller för