編輯

共用方式為


SyndicationFeed.AttributeExtensions Property

Definition

Gets a collection of attribute extensions.

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.

SyndicationFeed feed = new SyndicationFeed();

//Attribute extensions are stored in a dictionary indexed by XmlQualifiedName
feed.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");
Dim feed As 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">

Remarks

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.

Applies to