共用方式為


SyndicationItem.Authors 屬性

定義

取得新聞訂閱項目的作者。

public:
 property System::Collections::ObjectModel::Collection<System::ServiceModel::Syndication::SyndicationPerson ^> ^ Authors { System::Collections::ObjectModel::Collection<System::ServiceModel::Syndication::SyndicationPerson ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.ServiceModel.Syndication.SyndicationPerson> Authors { get; }
member this.Authors : System.Collections.ObjectModel.Collection<System.ServiceModel.Syndication.SyndicationPerson>
Public ReadOnly Property Authors As Collection(Of SyndicationPerson)

屬性值

代表新聞訂閱項目作者的 SyndicationPerson 物件集合。

範例

下列程式碼會示範如何將作者加入至 AuthorsSyndicationItem 集合。

SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"));
item.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"))
item.Authors.Add(New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:' contoso/jesper"))

下列 XML 會說明前面的 SyndicationItem 如何序列化為 Atom 1.0。

<entry>
  <id>Item ID</id>
  <title type="text">My Item</title>
  <updated>2007-03-16T23:00:59Z</updated>
  <author>
    <name>Lene Aaling</name>
    <uri>http://contoso/Lene</uri>
    <email>lene@contoso.com</email>
  </author>
  <link rel="alternate" href="http://someserver/MyItem" />
  <link rel="alternate" type="text/html" title="Alternate Link" length="1000" href="http://otherserver/Item" />
  <content type="text">This is some content</content>
</entry>

下列 XML 會說明前面的 SyndicationItem 如何序列化為 RSS 2.0。

<item>
  <guid isPermaLink="false">Item ID</guid>
  <link>http://someserver/MyItem</link>
  <author>someone@mycompany.com</author>
  <title>My Item</title>
  <description>This is some content</description>
  <a10:link rel="alternate" type="text/html" title="Alternate Link" length="1000" href="http://otherserver/Item" />
  <a10:updated>2007-03-16T23:00:59Z</a10:updated>
</item>

備註

當序列化至 Atom 1.0 時,會將 <author> 項目寫入 SyndicationPerson 集合中的每個 Authors

當序列化為 RSS 2.0 時,如果 如果 Authors 集合只有一個 SyndicationPerson ,則會寫入專案 <managingEditor> ,否則 <a10:author> 會為 SyndicationPerson 集合中的每個 Authors 專案寫入。

適用於