我需要從這個表中的數據放入一個數組,然後在控制檯中將數組打印爲格式化的表。 下面是我從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) –