Export (0) Print
Expand All

SyndicationFeed.AttributeExtensions Property

Gets a collection of attribute extensions.

Namespace:  System.ServiceModel.Syndication
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public Dictionary<XmlQualifiedName, string> AttributeExtensions { get; }

Property Value

Type: System.Collections.Generic.Dictionary<XmlQualifiedName, String>
A dictionary that contains a collection of attribute extensions.

An attribute extension is a valid XML attribute that is not specified in either the Atom 1.0 or RSS 2.0 specifications. When serialized to Atom 1.0, each custom attribute in the collection is written to the <atom> element. When serialized to RSS 2.0, each custom attribute is written to the <channel> element. For an example of adding an attribute extension, see the Loosely-Typed Extensions Sample sample.

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

SyndicationFeed feed = new SyndicationFeed();

//Attribute extensions are stored in a dictionary indexed by XmlQualifiedName
feed.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");

The following XML shows how an attribute extension is serialized to Atom 1.0.

<feed xml:lang="en-us" CustomAttribute="Value" xmlns="http://www.w3.org/2005/Atom">

The following XML shows how an attribute extension is serialized to RSS 2.0.

<channel CustomAttribute="Value">

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft