var file = File.Open("D:\\tx.txt", FileMode.Open);
List<string> txt = new List<string>();
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();
温馨提示:答案为网友推荐,仅供参考