【发布时间】:2015-10-15 04:09:46
【问题描述】:
标题非常不言自明,看起来应该是一件容易的事,但我尝试过的一切都没有奏效:
这是我的代码,工作正常,但表格是可变的,所以我需要知道它返回的列:
var data = db.Query("SELECT * FROM " + Table);
以下是我尝试过的技术列表:
data.GetType().GetProperties().ToList();
// prints 'Int32 Count' and 'System.Object Item [Int32]'
data.GetDynamicMemberNames()
// Error: '...IEnumerable<dynamic> does not have a definition for GetDynamicMemberNames'
// I also tried using System.Linq and System.Dynamic
I could also iterate through a loop, but there's got to be a more elegant way, right?
我想以列名的List<String> 结尾。
【问题讨论】: