SyndicationPerson.AttributeExtensions 属性

定义

获取 SyndicationPerson 的属性扩展。Gets the attribute extensions for the SyndicationPerson.

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)

属性值

Dictionary<XmlQualifiedName,String>

一个包含属性扩展集合的字典。A dictionary that contains a collection of attribute extensions.

示例

下面的代码演示如何将属性扩展添加到 SyndicationPerson 实例。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");
Dim sp As New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg")
sp.AttributeExtensions.Add(New XmlQualifiedName("myAttribute", ""), "someValue")

下面的 XML 演示如何将 AttributeExtensions 集合序列化为 Atom 1.0。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>

下面的 XML 演示如何将 AttributeExtensions 集合序列化为 RSS 2.0。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>

注解

联合对象模型允许您将自定义属性添加到 SyndicationPerson 实例中。The Syndication object model allows you to add custom attributes to a SyndicationPerson instance. 您可以添加任何有效的 XML 属性/值。You can add any valid XML attribute/value.

序列化为 Atom 1.0 时,会将任何自定义属性/值以 <author><contributor> 元素中的属性形式写入。When serialized to Atom 1.0, any custom attribute/value is written as an attribute in the <author> or <contributor> elements. 当序列化为 RSS 2.0 时,会将任何自定义属性/值作为 <managingEditor><a10:contributor><a10:author> 元素中的一个属性写入。When serialized to RSS 2.0, any custom attribute/value is written as an attribute in the <managingEditor>, <a10:contributor>, or <a10:author> elements.

适用于