Editar

Compartir a través de


SyndicationItem.AttributeExtensions Property

Definition

Gets the attribute extensions for the syndication item.

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)

Property Value

A dictionary that contains a collection of attribute extensions.

Examples

The following code shows how to add an attribute extension to a syndication feed.

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

The following XML code shows an Atom 1.0 serialization of a SyndicationItem instance with a custom attribute called itemAttrib.

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

The following code shows the same SyndicationItem instance serialized as 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>

Remarks

The Syndication object model allows you to add custom attributes to a SyndicationItem instance. When serialized for Atom 1.0, the custom attribute is written to an <entry> element. When serialized for RSS 2.0, the custom attribute is written to an <item> element. For a complete example that shows how to add an attribute extension, see the Loosely-Typed Extensions sample.

Applies to