操作文件

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Util
{
    
public class WriteFile
    {
        
public static void WriteText(string fileName, string content)
        {
            TextWriter tw 
= new StreamWriter(fileName, false);
            tw.WriteLine(content);
            tw.Close();
        }

        
public static string ReadText(string fileName)
        {
            TextReader tr 
= new StreamReader(fileName);
            
string content = tr.ReadToEnd();
            tr.Close();
            
return content;
        }
    }
}
posted @ 2008-07-01 22:06  angushine  阅读(166)  评论(0编辑  收藏  举报