中の技術日誌ブログ

C#とC++/CLIと
VBと.NETとWindowsで戯れる
 

目次

Blog 利用状況

ニュース

自己紹介

東京でソフトウェアエンジニアをやっています。
お仕事大募集中です。
記事執筆や、講師依頼とかでも何でもどうぞ(*^_^*)
似顔絵 MSMVPロゴ
MSMVP Visual C# Since 2004/04-2013/03

記事カテゴリ

書庫

日記カテゴリ

00-整理

01-MSMVP

わんくまブログをつくろう その5 激しく短く

public static List<SyndicationItem> GetData()
{
    var context = new DataClasses1DataContext();

    var queryable =
        (from x in context.blog_Contents
         where x.ID > 10000
         orderby x.ID descending
         select x).Take(10);
    var ReturnValue = new List<SyndicationItem>();

    foreach (var content in queryable)
    {
        var item1 = new SyndicationItem(content.Title, content.Text, new Uri("http://blogs.wankuma.com"));
        ReturnValue.Add(item1);
    }
    return ReturnValue;
}

context.Response.ContentType = "text/xml;";

var feed = new SyndicationFeed("わんくまブログフィード", "わんくまブログのRSS,Atomフィードを提供しています。",new Uri("http://blogs2.wankuma.com"));
feed.Authors.Add(new SyndicationPerson("naka@wankuma.com"));
feed.Categories.Add(new SyndicationCategory("わんくま"));
feed.Description = new TextSyndicationContent("わんくまブログのRSS,Atomフィードを提供しています。");
feed.Items = RSSData.GetData();
var writer = XmlWriter.Create(context.Response.OutputStream);
feed.SaveAsRss20(writer);
writer.Flush();

 

こんなコードだけでRSSを吐けるなんてすげーよね。

image

投稿日時 : 2008年3月26日 21:16

コメントを追加

# IAaVHVoQcfhamJxNG 2011/11/28 20:27 http://www.spytown.com/

I do`t regret that spent a few of minutes for reading. Write more often, surely'll come to read something new!...

# MdjmivDgueOdGNnGXuV 2011/12/16 0:52 http://www.yacanna.com/

I was looking for the report in Yandex and suddenly came across this page. I found a little information on my topic of my report. I would like more, and thanks for that..!

# NXpiswowpCaerM 2012/01/04 5:19 http://www.kosherbeefjerky.net/

21IS9y Thanks for the news! Just was thinking about it! By the way Happy New Year to all of you:D

# iruJRmJKkarhtU 2012/01/07 14:16 http://www.luckyvitamin.com/p-9250-bhi-heel-traume

I`m so grateful that you enlightened me and the most important thing that it happened in time. Just think, I have been using the internet for six years already but it`s the first time I`ve ever heard about it!...

タイトル
名前
URL
コメント