1个回答
展开全部
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string _FileFullPath = "D:\test.txt";
var _Strs = new List<string>();
if (File.Exists(_FileFullPath))
{
StreamReader _Sr = new StreamReader(_FileFullPath);
while (!_Sr.EndOfStream)
{
var _Str = _Sr.ReadLine();
// 将_Str 存入数组中即可
_Strs.Add(_Str);
// Console.WriteLine(_Str);
}
}
}
}
}
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string _FileFullPath = "D:\test.txt";
var _Strs = new List<string>();
if (File.Exists(_FileFullPath))
{
StreamReader _Sr = new StreamReader(_FileFullPath);
while (!_Sr.EndOfStream)
{
var _Str = _Sr.ReadLine();
// 将_Str 存入数组中即可
_Strs.Add(_Str);
// Console.WriteLine(_Str);
}
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询