是否可以按名称或索引选择列,这些列存储在数组中?
String[] columnsWhichINeed = new String[] { "column1", "column2" };
DataColumn[] aCols = dataTable.Columns.Cast<DataColumn>()
.Where(c => c.ColumnName.NEEDSOMEMAGICHERE;
.Select(c => new DataColumn(c.ColumnName, c.DataType))
.ToArray();
答案 0 :(得分:3)
您可以使用{/ 1}}方法,例如
Contains()
答案 1 :(得分:0)
我认为您正在寻找的是<body>
<iframe style="max-width: 480px" width="100%" height="360" src="http://www.youtube.com/embed?max-results=1&controls=0&showinfo=0&rel=0&listType=user_uploads&list=UCvDJ_vg2dics1kmwUPnTo_A" frameborder="0" allowfullscreen></iframe>
</body>
:
Contains()
除非你需要进行不区分大小写的字符串匹配,在这种情况下你需要DataColumn[] aCols = dataTable.Columns.Cast<DataColumn>()
.Where(c => columnsWhichINeed.Contains(c.ColumnName))
.Select(c => new DataColumn(c.ColumnName, c.DataType))
.ToArray();
:
Any()