ASP.NET 生成 RSS Feed
前段时间在写RSS Feed。
经过了几次的修改,把相关的代码写成了单独的类。感觉重用时还算比较方便的。于是贴出来,大家一起研究研究。以下是RssBase.cs类:
1using System;
2using System.Collections.Generic;
3using System.Xml;
4
5namespace MyMedia.Utilities
6{
7 public class RssBase
8 {
9 RssBase constructor#region RssBase constructor
10 public RssBase(XmlTextWriter rssWriter)
11 {
12 this.rssWriter = rssWriter;
13 }
14 public RssBase(XmlTextWriter rssWriter, bool hasMedia, IList<ItemInfo> items)
15 {
16 this.rssWriter = rssWriter;
17 this.hasMedia = hasMedia;
18 this.items = items;
19 }
20 #endregion
21
22 [Serializable]
23 public sealed class ItemInfo
24 {
25 ItemInfo constructor#region ItemInfo constructor
26 public ItemInfo() { }
27 public ItemInfo(string itemTitle, string itemLink, string itemDescription, string itemPubDate, string itemAuthor, string itemGuid)
28 {
29 this.itemTitle = itemTitle;
30 this.itemLink = itemLink;
31 this.itemDescription = itemDescription;
32 this.itemAuthor = itemAuthor;
33 this.itemGuid = itemGuid;
34 this.itemPubDate = itemPubDate;
35 }
36 public ItemInfo(string itemTitle, string itemLink, string itemDescription, string itemPubDate, string itemAuthor,
37 string itemGuid, string mediaContentUrl, string mediaTitle, string mediaDescription,
38 string mediaThumbUrl, string mediaThumbWidth, string mediaThumbHeight, string mediaAuthor)
39 {
40 this.itemTitle = itemTitle;
41
相关新闻>>
- 发表评论
-
- 最新评论 更多>>