SyndicationFeed.Description 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置源的说明。
public:
property System::ServiceModel::Syndication::TextSyndicationContent ^ Description { System::ServiceModel::Syndication::TextSyndicationContent ^ get(); void set(System::ServiceModel::Syndication::TextSyndicationContent ^ value); };
public System.ServiceModel.Syndication.TextSyndicationContent Description { get; set; }
member this.Description : System.ServiceModel.Syndication.TextSyndicationContent with get, set
Public Property Description As TextSyndicationContent
属性值
一个表示源说明的 TextSyndicationContent 对象。
示例
下面的代码演示如何设置 Description 的 SyndicationFeed。
List<SyndicationItem> items = new List<SyndicationItem>();
SyndicationItem item1 = new SyndicationItem();
item1.Title = new TextSyndicationContent("Item 1");
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1");
items.Add(item1);
SyndicationItem item2 = new SyndicationItem();
item2.Title = new TextSyndicationContent("Item 2");
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2");
items.Add(item2);
SyndicationFeed feed = new SyndicationFeed(items);
feed.Description = new TextSyndicationContent("This is a feed description");
Dim items As New List(Of SyndicationItem)()
Dim item1 As New SyndicationItem()
item1.Title = New TextSyndicationContent("Item 1")
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1")
items.Add(item1)
Dim item2 As New SyndicationItem()
item2.Title = New TextSyndicationContent("Item 2")
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2")
items.Add(item2)
Dim feed As New SyndicationFeed(items)
feed.Description = New TextSyndicationContent("This is a feed description")
下面的 XML 演示如何将 Description 序列化为 Atom 1.0。
<subtitle type="text">This is a sample feed</subtitle>
下面的 XML 演示如何将 Description 序列化为 RSS 2.0。
<description>This is a sample feed</description>
注解
序列化为 Atom 1.0 时, Description 会写入 <subtitle>
元素。
序列化为 RSS 2.0 时, Description 会写入 <description>
元素。