.net 读取文件
/// <summary> /// 读取文本文件 /// </summary> /// <param name="txtfileName">文件路径</param> private void FromTxtTodata(string txtfileName) { string txt = ""; using (StreamReader reader = new StreamReader(txtfileName,Encoding.Default )) { //循环读取所有行 //while (!reader.EndOfStream) //{ // txt += reader.ReadLine() + System.Environment.NewLine; //} txt += reader.ReadToEnd(); } MessageBox.Show("导入完成!"); }