Share via


SyndicationItem.Content 屬性

定義

取得或設定新聞訂閱項目的內容。

public:
 property System::ServiceModel::Syndication::SyndicationContent ^ Content { System::ServiceModel::Syndication::SyndicationContent ^ get(); void set(System::ServiceModel::Syndication::SyndicationContent ^ value); };
public System.ServiceModel.Syndication.SyndicationContent Content { get; set; }
member this.Content : System.ServiceModel.Syndication.SyndicationContent with get, set
Public Property Content As SyndicationContent

屬性值

SyndicationContent

包含新聞訂閱項目內容的 SyndicationContent 執行個體。

範例

下列程式碼會示範如何將內容加入至 SyndicationItem

SyndicationItem item = new SyndicationItem("Item Title", "Item Content", new Uri("http://Item/Alternate/Link"));
item.Content = new TextSyndicationContent("This is the content of the syndication item");
Dim item As New SyndicationItem("Item Title", "Item Content", New Uri("http:' Item/Alternate/Link"))
item.Content = New TextSyndicationContent("This is the content of the syndication item")

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

TextSyndicationContent 序列化的方式如下列範例所示。

<content type="text">This is some content</content>  

UrlSyndicationContent 序列化的方式如下列範例所示。

<content type="text/html" src="http://myurl/" />  

XmlSyndicationContent 序列化的方式如下列範例所示。

<content type="MyXMLType">  
    <mg:MyElement xmlns:mg="http://migree/elements">This is some text</mg:MyElement>  
</content>  

下列 XML 會說明如何針對 RSS 2.0 序列化 Content 屬性。

TextSyndicationContent 序列化的方式如下列範例所示。

<description>This is some content</description>  

UrlSyndicationContent 序列化的方式如下列範例所示。

<a10:content type="text/html" src="http://myurl/" />  

XmlSyndicationContent 序列化的方式如下列範例所示。

<a10:content type="MyXMLType">  
    <mg:MyElement xmlns:mg="http://migree/elements">This is some text</mg:MyElement>  
</a10:content>  

備註

SyndicationContent 是所有新聞訂閱內容類型的基類。 .NET Framework 3.5 定義下列新聞訂閱內容類型:

您可將此屬性指派至任何內容型別 (或是衍生自 使用者定義型別)。

如果是 Atom 1.0,Content 屬性會序列化至 <content> 項目。

如果是 RSS 2.0,Content 屬性會序列化至 <description>TextSyndicationContent 項目,<a10:content>UrlSyndicationContentXmlSyndicationContent 項目。

適用於