ps做网站ui,免费微信网站制作平台,效果好的魔站建站系统,网站备案提交资料引用#xff1a;System.IO;
Path.Combine(); //将字符串组合成一个路径
Path.GetFullPath(); //返回指定路径的绝对路径
File.ReadAllLines(); //读取文本框返回一个数组
File.ReadAllText(); //读取文本框返回一个字符串
File.ReadAllBytes(); //读取文本框返回字节 … 引用System.IO;
Path.Combine(); //将字符串组合成一个路径
Path.GetFullPath(); //返回指定路径的绝对路径
File.ReadAllLines(); //读取文本框返回一个数组
File.ReadAllText(); //读取文本框返回一个字符串
File.ReadAllBytes(); //读取文本框返回字节 class Program{static void Main(string[] args){//string filePath D:t_sql.txt; //如果直接拼接可能会报错不支持给定的路径string str Path.Combine(D:, t_sql.txt);string str1 Path.GetFullPath(str);try{//读取文本所有行然后关闭 结果以文本的行为单位返回数组string[] content File.ReadAllLines(str);Console.WriteLine(content);//读取文本所有行然后关闭 结果以整个文本为单位返回字符串string content1 File.ReadAllText(str);Console.WriteLine(content1);}catch (IOException e){Console.WriteLine(An IO exception has been thrown!);Console.WriteLine(e.ToString());}Console.ReadKey();}}