SyndicationPerson.AttributeExtensions Property

 

Gets the attribute extensions for the SyndicationPerson.

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.

The Syndication object model allows you to add custom attributes to a SyndicationPerson instance. You can add any valid XML attribute/value.

When serialized to Atom 1.0, any custom attribute/value is written as an attribute in the <author> or <contributor> elements. When serialized to RSS 2.0, any custom attribute/value is written as an attribute in the <managingEditor>, <a10:contributor>, or <a10:author> elements.

The following code shows how to add an attribute extension to a SyndicationPerson instance.

SyndicationPerson sp = new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg");
sp.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");

The following XML shows how the AttributeExtensions collection is serialized to Atom 1.0.

<author customAttribute="value">
  <name>Syed Abas</name>
  <uri>http://Syed/Abas</uri>
  <email>Syed.Abas@contoso.com</email>
</author>

The following XML shows how the AttributeExtensions collection is serialized to RSS 2.0.

<a10:author customAttribute="value">
  <a10:name>Syed Abas</a10:name>
  <a10:uri>http://Syed/Abas</a10:uri>
  <a10:email>Syed.Abas@contoso.com</a10:email>
</a10:author>

.NET Framework
Available since 3.5
Silverlight
Available since 2.0
Return to top
Show: