【发布时间】:2010-09-19 05:43:51
【问题描述】:
有没有更好的方法来做到这一点?
string[] s = {"zero", "one", "two", "three", "four", "five"};
var x =
s
.Select((a,i) => new {Value = a, Index = i})
.Where(b => b.Value.StartsWith("t"))
.Select(c => c.Index);
即我正在寻找一种更有效或更优雅的方式来获取符合条件的项目的位置。
【问题讨论】:
标签: c# .net arrays linq indexof