SyndicationPerson.Name 属性

定义

获取或设置 SyndicationPerson 的名称。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

属性值

String

人员的名称。

示例

下面的代码演示如何设置 SyndicationPerson 的名称。

SyndicationPerson sp = new SyndicationPerson();
sp.Name = "Jesper Aaberg";
Dim sp As New SyndicationPerson()
sp.Name = "Jesper Aaberg"

下面的 XML 演示如何将 Name 序列化为 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 演示如何将 Name 序列化为 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>

注解

序列化为 Atom 1.0 时,会将 Name 属性以 <name> 元素形式写入。 <name> 元素出现在 <author><contributor> 元素中,这取决于向其中添加 SyndicationPerson 的集合(作者或参与者)。

序列化为 RSS 2.0 时,会将 Name 属性以 <a10:name> 元素形式写入。 <a10:name> 元素出现在 <managingEditor><a10:author><a10:contributor> 元素中。 如果只有一个 SyndicationPerson 添加到作者集合,则会将 <a10:name> 元素写入 <managingEditor> 元素中。 如果有多个 SyndicationPerson 添加到作者集合,则会将 <a10:name> 元素写入 <a10:author> 元素中。 如果将 SyndicationPerson 添加到参与者集合,则会将 <a10:name> 元素写入 <a10:contributor> 元素中。

适用于