请教:C#如何定义过程返回数组?
将datatable dt中的字段名(列名)读到数组中,然后返回数组。
谢谢
[最优解释]
DataTable dt = new DataTable();
string[] colname=new string[dt.Columns.Count ];
for (int i = 0; i < dt.Columns.Count; i++)
{
colname[i] = dt.Columns[i].ColumnName.ToString();
}
for (int i = 0; i < colname.Length ; i++)
{
MessageBox.Show ( colname[i] );
}