【发布时间】:2014-07-03 19:41:26
【问题描述】:
我正在使用这个:
var temp = conLines.Select((l, i) => new {l, i}).FirstOrDefault(r => (r.l.IndexOf(item.firstParam) >= 0
&& r.l.IndexOf(item.secondParam) >= 0)
&& (r.l.IndexOf(item.firstParam) < r.l.IndexOf(item.secondParam)
));
但我不想在第一次找到 conLines 的某个子字符串(列表)之前开始“FirstOrDefault”。
例子:
conLines 看起来像这样:
NAME:
NOTES:
REVISION HISTORY:
format AT 1024 1 4
1 AC BUS ENUM 0030 04 0 0 1/1 632
NORMAL 04096 1 0,1
2 AC BUS-02 ENUM 00C0 06 0 0 1/1 632
NORMAL 04096 1 0,1
我不希望它在下一行之后才开始寻找“FirstOrDefault”,但重要的是我仍然在整个 conLines 列表的上下文中跟踪 temp.i
format AT 1024 1 4
我想 SkipWhile 和 StartsWith 可能有效,但我没有取得任何成功
【问题讨论】: