操作文件
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;
}
}
}
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;
}
}
}