var file = File.Open("D:\\tx.txt", FileMode.Open);
Listtxt = new List ();
using (var stream = new StreamReader(file))
{
while (!stream.EndOfStream)
{
txt.Add(stream.ReadLine());
}
}
var array = new string[10,10];
var line = 0;
txt.ForEach(t => {
var row = 0;
t.Split(',').ToList().ForEach(p => {
array.SetValue(p, line, row);
row++;
});
line++;
});
file.Close();
while循环,readline读取,spilt根据‘,’分成数组。