【发布时间】:2012-01-04 15:59:59
【问题描述】:
我有一个数组:
string[] exceptions = new string[] { "one", two", "one_1", "three" };
..我想说:
var result = from c in myCollection
where not c.Property[3].Value.StartWith(exceptions)
select c;
所以我希望过滤 myCollection 以仅显示那些 Property[3].Value 在异常数组中不 StartWith 的值。我知道 StartsWith 不会收集,所以我不确定这是否可以通过 LINQ 实现。
这在 LINQ 中可能吗?!还是我试图将我的问题硬塞到 LINQ 解决方案中?
编辑:我应该说,包含不是一个选项,因为我只想排除属性以异常字符串开头的元素。
【问题讨论】:
标签: c# .net arrays linq comparison