SyndicationPerson 類別

定義

表示新聞訂閱內容的作者或參與者。Represents an author or contributor of syndication content.

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

範例

下列程式碼會示範如何將 SyndicationPerson 加入至 SyndicationFeed 執行個體的作者集合。The following code shows how to add a SyndicationPerson to the authors collection of a SyndicationFeed instance.

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。The following XML shows how a SyndicationPerson is serialized to 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。The following XML shows how a SyndicationPerson is serialized to 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 物件上的作者和參與者集合中。SyndicationPerson objects can be added to the authors and contributors collections on SyndicationFeed and SyndicationItem objects.

序列化為 Atom 1.0 時,會將 SyndicationPerson 做為 <author><contributor> 項目寫出。When serialized to Atom 1.0, the SyndicationPerson is written out as an <author> or <contributor> element.

序列化為 RSS 2.0 時,會將 SyndicationPerson 執行個體做為 <managingEditor><a10:author><a10:contributor> 項目寫出。When serialized to RSS 2.0, a SyndicationPerson instance is written out as a <managingEditor>, <a10:author>, or <a10:contributor> element. 序列化 SyndicationPerson 的方式需取決於新增至 SyndicationPersonSyndicationFeedSyndicationItem 物件數目、SyndicationPerson 執行個體新增至哪一個集合,以及傳入 SerializeExtensionAsAtom 建構函式的 Rss20ItemFormatter(SyndicationItem, Boolean) 參數值。How a SyndicationPerson is serialized depends on the number of SyndicationPerson objects added to a SyndicationFeed or SyndicationItem, which collection the SyndicationPerson instances are added to, and the value of the SerializeExtensionAsAtom parameter to the Rss20ItemFormatter(SyndicationItem, Boolean) constructor. 如果只新增一個 SyndicationPersonAuthors (或 Authors) 集合中,SyndicationPerson 會序列化為 <managingEditor> 項目。If only one SyndicationPerson is added to the Authors (or Authors) collection, the SyndicationPerson is serialized to a <managingEditor> element. 如果新增一個以上的 SyndicationPersonAuthors (或 Authors) 集合中,而且 SerializeExtensionsAsAtom 設定為 true,所有的 SyndicationPerson 物件都會序列化為 <a10:author> 項目。If more than one SyndicationPerson is added to the Authors (or Authors) collection and SerializeExtensionsAsAtom is set to true, all of the SyndicationPerson objects are serialized to <a10:author> elements. 如果 SerializeExtensionsAsAtom 設定為 falseSyndicationPerson 執行個體便不會序列化。If SerializeExtensionsAsAtom is set to false, the SyndicationPerson instances is not serialized. 只有在 SyndicationPerson 設為 Contributors 時,才會序列化任何新增至 Contributors (或 SerializeExtensionsAsAtom) 集合的 true 執行個體,在這個情況中會序列化為 <a10:contributor> 項目。Any SyndicationPerson instances added to the Contributors (or Contributors) collection are only serialized if SerializeExtensionsAsAtom is set to true, in which case they are serialized to <a10:contributor> elements.

建構函式

SyndicationPerson()

初始化新的 SyndicationPerson 執行個體。Initializes a new SyndicationPerson instance.

SyndicationPerson(String)

使用指定的電子郵件地址,初始化新的 SyndicationPerson 執行個體。Initializes a new SyndicationPerson instance with the specified email address.

SyndicationPerson(String, String, String)

使用指定的電子郵件地址、名稱及統一資源識別碼 (URI) 初始化新的 SyndicationPerson 執行個體。Initializes a new SyndicationPerson instance with the specified email address, name, and Uniform Resource Identifier (URI).

SyndicationPerson(SyndicationPerson)

使用指定的執行個體,初始化 SyndicationPerson 類別的新執行個體。Initializes a new instance of the SyndicationPerson class with the specified instance.

屬性

AttributeExtensions

取得 SyndicationPerson 的屬性延伸。Gets the attribute extensions for the SyndicationPerson.

ElementExtensions

取得 SyndicationPerson 的項目延伸。Gets the element extensions for the SyndicationPerson.

Email

取得或設定 SyndicationPerson 的電子郵件地址。Gets or sets the email address of the SyndicationPerson.

Name

取得或設定 SyndicationPerson 的名稱。Gets or sets the name of the SyndicationPerson.

Uri

取得或設定 SyndicationPerson 的 URI。Gets or sets the URI of the SyndicationPerson.

方法

Clone()

建立現有 SyndicationPerson 執行個體的複本。Creates a copy of the existing SyndicationPerson instance.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

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

嘗試剖析屬性延伸。Attempts to parse an attribute extension.

TryParseElement(XmlReader, String)

嘗試剖析項目延伸。Attempts to parse an element extension.

WriteAttributeExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將屬性延伸寫入指定的 XmlWriterWrites the attribute extensions to the specified XmlWriter using the specified syndication version.

WriteElementExtensions(XmlWriter, String)

使用指定的新聞訂閱版本,將項目延伸寫入至指定的 XmlWriterWrites the element extensions to the specified XmlWriter using the specified syndication version.

適用於