/// summary /// 读文件方法 /// /summary /// param name="filename"文件名/param /// returns文件内容/returns private string ReadFile(string filename) { string str = ""; string filenamepath = filename; //打开文件 StreamReader sr = File.OpenTex
///
/// 读文件方法
///
/// 文件名
///
private string readfile(string filename)
{
string str = "";
string filenamepath = filename;
//打开文件
streamreader sr = file.opentext(filenamepath);
str = sr.readtoend();
sr.close();
return str;
}
///
/// 写文件方法
///
/// 文件名
/// 文件内容
public void WriteFile(string Path, string Strings)
{
StreamWriter sw = null;
try
{
sw = new StreamWriter(Path, false, System.Text.Encoding.UTF8);
sw.Write(Strings);
sw.Flush();
}
catch (Exception exp)
{
HttpContext.Current.Response.Write(exp.Message);
HttpContext.Current.Response.End();
}
finally
{
sw.Close();
}
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号