SyndicationItem.Links 屬性

定義

取得新聞訂閱項目包含的連結。

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

屬性值

SyndicationLink 物件的集合。

範例

下列程式碼會示範如何將連結加入至 Links 執行個體的 SyndicationItem 集合。

SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"));
item.Links.Add(new SyndicationLink(new Uri("http://server/link"), "alternate", "Link Title", "text/html", 1000));
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"))
item.Links.Add(New SyndicationLink(New Uri("http:' server/link"), "alternate", "Link Title", "text/html", 1000))

下列 XML 說明如何將這個屬性序列化為 Atom 1.0。

<link rel="alternate" href="http://someserver/MyItem" />
<link rel="alternate" type="text/html" title="Alternate Link" length="1000" href="http://alternate/Link" />
<entry p2:itemAttrib="ItemAttribValue" xmlns:p2="http://FeedServer/tags">
  <title type="text">My Item</title>

  <summary type="text">this is a summary for my item</summary>

  <author>
    <name>Jesper Aaberg</name>
    <uri>http://contoso/jesper</uri>
    <email>jesper@contoso.com</email>
  </author>

下列 XML 說明如何將這個屬性序列化為 RSS 2.0。

<link>http://someserver/MyItem</link>
<link>http://alternate/Link</link>

備註

當序列化至 Atom 1.0 時,會對集合中的每個 <link> 寫入 SyndicationLink 項目。 當序列化至 RSS 2.0 時,會對集合中的每個 <a10:link> 寫入 SyndicationLink 項目。

適用於