LINQ: Get Table Column Names

后端 未结 11 728
-上瘾入骨i
-上瘾入骨i 2020-12-31 01:14

Using LINQ, how can I get the column names of a table? C# 3.0, 3.5 framework

11条回答
  •  爱一瞬间的悲伤
    2020-12-31 01:28

    In LinqPad:

    TableNames.Take(1) works.

    It is fast to type. (Although you in an ideal world, it would be nicer to not select any rows.)

    Note it is the pluralized form of TableName. You can also do Take(0) and look at the SQL results tab.

提交回复
热议问题