SyndicationItem.AttributeExtensions Property

Definition

Gets the attribute extensions for the syndication item.

public System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName,string> AttributeExtensions { get; }

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");

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

Продукт Версії
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)