SyndicationFeed.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)

属性值

Collection<SyndicationLink>

SyndicationLink 对象的集合。

示例

下面的代码演示如何将链接添加到 Links 实例的 SyndicationFeed 集合中。

SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);
feed.Links.Add(new SyndicationLink(new Uri("http://server/link"), "alternate", "Link Title", "text/html", 1000));
Dim feed As New SyndicationFeed("Feed Title", "Feed Description", New Uri("http:'Feed/Alternate/Link"), "FeedID", DateTime.Now)
feed.Links.Add(New SyndicationLink(New Uri("http:'server/link"), "alternate", "Link Title", "text/html", 1000))

下面的 XML 演示如何将 Links 集合序列化为 Atom 1.0。

<link rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />

下面的 XML 演示如何将 Links 集合序列化为 RSS 2.0。

<link rel="alternate" type="text/html" title="Link Title" length="1000" href="http://contoso/link" />

注解

序列化为 Atom 1.0 时,集合 Links 将写入多个 <link> 元素。

序列化为 RSS 2.0 时,集合 Links 将写入多个 <a10:link> 元素。

适用于