SyndicationPerson.ElementExtensions 屬性

定義

取得 SyndicationPerson 的項目延伸。

public:
 property System::ServiceModel::Syndication::SyndicationElementExtensionCollection ^ ElementExtensions { System::ServiceModel::Syndication::SyndicationElementExtensionCollection ^ get(); };
public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get; }
member this.ElementExtensions : System.ServiceModel.Syndication.SyndicationElementExtensionCollection
Public ReadOnly Property ElementExtensions As SyndicationElementExtensionCollection

屬性值

SyndicationElementExtensionCollection

包含項目延伸的 SyndicationElementExtensionCollection

範例

下列程式碼示範如何將項目延伸加入至 SyndicationPerson 執行個體。

SyndicationPerson sp = new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg");
sp.ElementExtensions.Add("simpleString", "", "hello, world!");
Dim sp As New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg")
sp.ElementExtensions.Add("simpleString", "", "hello, world!")

下列 XML 會說明 ElementExtensions 集合如何序列化為 Atom 1.0。

<author>
  <name>Kim Abercrombie</name>
  <uri>http://Kim/Abercrombie</uri>
  <email>Kim.Abercrombie@contoso.com</email>
  <customPersonElement xmlns="">person element text</customPersonElement>
</author>

下列 XML 會說明 ElementExtensions 集合如何序列化為 RSS 2.0。

<a10:author>
  <a10:name>Kim Abercrombie</a10:name>
  <a10:uri>http://Kim/Abercrombie</a10:uri>
  <a10:email>Kim.Abercrombie@contoso.com</a10:email>
  <customPersonElement>person element text</customPersonElement>
</a10:author>

備註

新聞訂閱物件模型允許您新增自訂 XML 項目至 SyndicationPerson 執行個體。 只要項目命名空間與包含命名空間不同,您便可以新增任何有效的 XML 項目。

序列化為 Atom 1.0 時,會將任何自訂項目做為 <author><contributor> 項目內的 XML 項目寫入。

序列化為 RSS 2.0 時,會將任何自訂項目做為 <managingEditor><a10:contributor><a10:author> 項目內的 XML 項目寫入。

適用於