SyndicationPerson 類別

定義

表示新聞訂閱內容的作者或參與者。

public ref class SyndicationPerson
public class SyndicationPerson
type SyndicationPerson = class
Public Class SyndicationPerson
繼承
SyndicationPerson

範例

下列程式碼會示範如何將 SyndicationPerson 加入至 SyndicationFeed 執行個體的作者集合。

SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);
SyndicationPerson sp = new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg");
feed.Authors.Add(sp);
Dim feed As New SyndicationFeed("Feed Title", "Feed Description", New Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now)
Dim sp As New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://Jesper/Aaberg")
feed.Authors.Add(sp)

下列 XML 顯示 SyndicationPerson 如何序列化為 Atom 1.0。

<author>
  <name>Jesper Aaberg</name>
  <uri>http://Jesper/Aaberg</uri>
  <email>Jesper.Aaberg@contoso.com</email>
</author>
<contributor>
  <name>Lene Aalling</name>
  <uri>http://Lene/Aaling</uri>
  <email>Lene.Aaling@contoso.com</email>
</contributor>

下列 XML 顯示 SyndicationPerson 如何序列化為 RSS 2.0。

<a10:author>
  <a10:name>Lene Aalling</a10:name>
  <a10:uri>http://Lene/Aalling</a10:uri>
  <a10:email>Lene.Aalling@contoso.com</a10:email>
</a10:author>
  <a10:contributor>
  <a10:name>Jesper Aaberg</a10:name>
  <a10:uri>http://Jesper/Aaberg</a10:uri>
  <a10:email>Jesper.Aaberg@contoso.com</a10:email>
</a10:contributor>

備註

您可以將 SyndicationPerson 物件加入至 SyndicationFeedSyndicationItem 物件上的作者和參與者集合中。

序列化為 Atom 1.0 時,會將 SyndicationPerson 做為 <author><contributor> 項目寫出。

序列化為 RSS 2.0 時,會將 SyndicationPerson 執行個體做為 <managingEditor><a10:author><a10:contributor> 項目寫出。 序列化 SyndicationPerson 的方式需取決於新增至 SyndicationPersonSyndicationFeedSyndicationItem 物件數目、SyndicationPerson 執行個體新增至哪一個集合,以及傳入 SerializeExtensionAsAtom 建構函式的 Rss20ItemFormatter(SyndicationItem, Boolean) 參數值。 如果只新增一個 SyndicationPersonAuthors (或 Authors) 集合中,SyndicationPerson 會序列化為 <managingEditor> 項目。 如果新增一個以上的 SyndicationPersonAuthors (或 Authors) 集合中,而且 SerializeExtensionsAsAtom 設定為 true,所有的 SyndicationPerson 物件都會序列化為 <a10:author> 項目。 如果 SerializeExtensionsAsAtom 設定為 falseSyndicationPerson 執行個體便不會序列化。 只有在 SyndicationPerson 設為 Contributors 時,才會序列化任何新增至 Contributors (或 SerializeExtensionsAsAtom) 集合的 true 執行個體,在這個情況中會序列化為 <a10:contributor> 項目。

建構函式

SyndicationPerson()

初始化新的 SyndicationPerson 執行個體。

SyndicationPerson(String)

使用指定的電子郵件地址,初始化新的 SyndicationPerson 執行個體。

SyndicationPerson(String, String, String)

使用指定的電子郵件地址、名稱及統一資源識別碼 (URI) 初始化新的 SyndicationPerson 執行個體。

SyndicationPerson(SyndicationPerson)

使用指定的執行個體,初始化 SyndicationPerson 類別的新執行個體。

屬性

AttributeExtensions

取得 SyndicationPerson 的屬性延伸。

ElementExtensions

取得 SyndicationPerson 的項目延伸。

Email

取得或設定 SyndicationPerson 的電子郵件地址。

Name

取得或設定 SyndicationPerson 的名稱。

Uri

取得或設定 SyndicationPerson 的 URI。

方法

Clone()

建立現有 SyndicationPerson 執行個體的複本。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TryParseAttribute(String, String, String, String)

嘗試剖析屬性延伸。

TryParseElement(XmlReader, String)

嘗試剖析項目延伸。

WriteAttributeExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將屬性延伸寫入指定的 XmlWriter

WriteElementExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將項目延伸寫入至指定的 XmlWriter

適用於