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. 如果只有一个 SyndicationPerson 添加到 Authors(或 Authors)集合,则会将 SyndicationPerson 序列化为 <managingEditor> 元素。If only one SyndicationPerson is added to the Authors (or Authors) collection, the SyndicationPerson is serialized to a <managingEditor> element. 如果有多个 SyndicationPerson 添加到 Authors(或 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 设置为 false,则不会序列化 SyndicationPerson 实例。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 的浅表副本。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.

适用于