我需要从这个表中的数据放入一个数组,然后在控制台中将数组打印为格式化的表。 下面是我从http://puu.sh/oqV8f/7d982f2665.jpg获得数据的表格;我只需要使数组输出行和列而不是列表。 我有这个至今:二维数组在c#中的表?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Zumba1
{
class Zumba
{
static void Main(string[] args)
{ //Recreated the data in the table for the zumba section, added each row, and each column.
string[,] schedule = new string [8, 6] { { "1:00", "3:00", "5:00", "7:00", "TOTAL", "", },
{"Monday", "12", "10", "17", "22", "244", },
{"Tuesday", "11", "13", "17", "22", "252",},
{"Wednesday", "12", "10", "22", "22", "264",},
{"Thursday", "9", "14", "17", "22", "248",},
{"Friday", "12", "10", "21", "12", "220",},
{"Saturday", "12", "10", "5", "10", "148"},
{" ", " ", " ", " ", " ","1376",}};
foreach (string i in schedule)
{
Console.WriteLine(i.ToString());
}
Console.ReadKey();
}
}
}
什么想法?
你在哪里卡住了? – mbeckish
你有一个二维数组,你想把它变成一张表?什么样的桌子? HTML表格?数据库表? – dfdsfdsfsdf
的可能的复制[格式化字符串转换成列(http://stackoverflow.com/questions/2978311/format-a-string-into-columns) –