SyndicationLink 類別

定義

表示新聞訂閱摘要或項目內的連結。Represents a link within a syndication feed or item.

public ref class SyndicationLink
public class SyndicationLink
type SyndicationLink = class
Public Class SyndicationLink
繼承
SyndicationLink

範例

下列範例將示範如何使用 SyndicationLink 類別。The following example shows how to use the SyndicationLink class.

SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);

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

Dim link As SyndicationLink = New SyndicationLink(New Uri("http://server/link"), "alternate", "Link Title", "text/html", 1000)
feed.Links.Add(link)

備註

SyndicationLink 可新增至 SyndicationFeedSyndicationItemSyndicationLink can be added to a SyndicationFeed or SyndicationItem. 序列化為 Atom 1.0 時,SyndicationLink 會寫出做為 <link> 項目,而且 SyndicationLink 屬性 (Property) 也會寫出做為 <link> 項目的屬性 (Attribute)。When serialized to Atom 1.0 a SyndicationLink is written out as a <link> element, with the SyndicationLink properties written out as attributes of the <link> element. 當序列化為 RSS 2.0 時, 會SyndicationLink將具有 ' 替代 ' 關聯性值的第一個當做<link>元素寫出。When serialized to RSS 2.0, the first SyndicationLink with a relationship value of 'alternate' is written out as a <link> element. 任何其他連結都會寫出做為 <a10:link> 項目。Any additional links are written out as a <a10:link> elements.

建構函式

SyndicationLink()

建立 SyndicationLink 執行個體的新執行個體。Creates a new instance of the SyndicationLink instance.

SyndicationLink(SyndicationLink)

使用指定的執行個體,初始化 SyndicationLink 類別的新執行個體。Initializes a new instance of the SyndicationLink class with the specified instance.

SyndicationLink(Uri)

使用指定的 SyndicationLink 初始化 Uri 類別的新執行個體。Initializes a new instance of the SyndicationLink class with the specified Uri.

SyndicationLink(Uri, String, String, String, Int64)

使用指定的 SyndicationLink、關聯類型、標題、媒體類型和長度,初始化 Uri 類別的新執行個體。Initializes a new instance of the SyndicationLink class with the specified Uri, relation type, title, media type, and length.

屬性

AttributeExtensions

取得連結的屬性延伸。Gets the attribute extensions of the link.

BaseUri

取得或設定新聞訂閱連結的基底 URI。Gets or sets the base URI of the syndication link.

ElementExtensions

取得 SyndicationLink 的項目延伸。Gets the element extensions for the SyndicationLink.

Length

取得或設定已連結資源的長度 (以位元組為單位)。Gets or sets the length of the linked resource in bytes.

MediaType

取得或設定已連結資源的媒體類型。Gets or sets the media type of the linked resource.

RelationshipType

取得或設定已連結資源的關聯類型。Gets or sets the relationship type of the linked resource.

Title

取得或設定已連結資源的標題。Gets or sets the title of the linked resource.

Uri

取得或設定已連結資源的 URI。Gets or sets the URI for the linked resource.

方法

Clone()

建立目前 SyndicationLink 執行個體的複本。Creates a copy of the current SyndicationLink instance.

CreateAlternateLink(Uri)

建立具有指定之 SyndicationLinkUri的新 物件。Creates a new SyndicationLink object with the specified Uri.

CreateAlternateLink(Uri, String)

建立具有指定之 SyndicationLink 與媒體類型的新 Uri 物件。Creates a new SyndicationLink object with the specified Uri and media type.

CreateMediaEnclosureLink(Uri, String, Int64)

建立具有指定 URI、媒體類型與長度的媒體內含連結。Creates a media enclosure link with the specified URI, media type, and length.

CreateSelfLink(Uri)

建立具有指定 URI 且關聯性類型設定為 self 的新 SyndicationLinkCreates a new SyndicationLink with the specified URI and relationship type set to self.

CreateSelfLink(Uri, String)

建立新的 SyndicationLink,其指定 URI、媒體類型和關係類型設為 selfCreates a new SyndicationLink with the specified URI, media type, and relationship type set to self.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetAbsoluteUri()

取得 SyndicationLink的絕對 URI。Gets the absolute URI for the SyndicationLink.

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.

適用於