using System;using System.Collections.Generic;using System.Linq;using System.IO;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { StreamReader rd = File.OpenText("data.txt"); string s = rd.ReadLine(); string[] ss = s.Split(‘,‘); int row = int.Parse(ss[0]); //行数 int col = int.Parse(ss[1]); //每行数据的个数 double[,] p1 = new double[row,col]; //数组 for (int i = 0; i < row; i++) //读入数据并赋予数组 { string line = rd.ReadLine(); string[] data = line.Split(‘,‘); for (int j = 0; j < col; j++) { p1[i, j] = double.Parse(data[j]); } } } }}原文:http://www.cnblogs.com/sevensir/p/7414107.html