782944910 发表于 2014-5-19 21:08:50

急急急 C#配置类对象的代码

求一个新闻阅读器RSS的C#配置类对象的代码,就是下面的profile.
ChannelInfoAddForm.cs主要是实现增加频道的文件。添加频道对话框中,在其“确定”按钮的响应事件里,对输入频道RSS文件的URL地址、名称及描述添加到频道集合,并在TreeView控件中显示更新Feeds集合中的频道。当用户退出RSS新闻聚集器前,创建user.profile文件,将每个频道的三个基本信息分别保存到user.profile文件的每一行中。见如下源代码:using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace ConsoleApplication4
{
    class Program
    {   
       static void Main(string[] args)
      {
            //创建文件流
            FileStream fs = new FileStream("user.profile", FileMode.Create);
            //创建写入器
            StreamWriter sw = new StreamWriter(fs);
            //将内容写入文件(写入频道总数)
            sw.WriteLine(profile.Feeds.Count);
            
            foreach (RSSFeed feed in profile.Feeds)
            {
                //Feed的3个基本信息每行存储一个
                sw.WriteLine(feed.Title);
                sw.WriteLine(feed.Url);
                sw.WriteLine(feed.Description);
            }
            sw.Close();
            fs.Close();
      }
         
    }
}

ibcadmin 发表于 2014-5-20 17:29:35

你咋又发了一遍...
页: [1]
查看完整版本: 急急急 C#配置类对象的代码