且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找匹配使用LINQ的条件元素的第一个索引

更新时间:2022-05-08 09:38:08

我需要更多的上下文,但如果你只是得到一个索引,使您可以拨打 .Skip ,我会建议采取看看 .SkipWhile

I'd need more context, but if you're just getting an index so that you can call .Skip, I would recommend taking a look at .SkipWhile.

如果你真正需要的指数,我建议编写自己的 .IndexOf 扩展方法。

If you do really need the index, I'd suggest writing your own .IndexOf extension method.