问题描述
我正在尝试返回包含三列的 DataTable 中的数据:
- commandTable.Columns.Add("Intent",typeof(string));
- commandTable.Columns.Add("Command",typeof(string));
- commandTable.Columns.Add("Permission",typeof(short));
我的目标是根据字符串与 Intent 列行上的 splittedMessage 数组的匹配来检索“命令”和“权限”。到目前为止,我能够使用命令实现结果
var result = commandTable.AsEnumerable().Where
(r => splittedMessage.Contains(r.Field<string>("Intent"))).Select(s => new
{
Command = s.Field<string>("Command"),Permission = s.Field<short>("Permission")
}).First();
但是现在,Intent 列从 typeof(string) 更改为 typeof(string[])。如何使用 Linq 和 Lambda 获取相同的数据,但将 splittedMessage 与数组内的字符串而不是逐行匹配单个字符串?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)