且构网

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

查找数组中某个值的索引

更新时间:2022-03-01 21:45:28

int keyIndex = Array.FindIndex(words, w => w.IsKey);

这实际上为您提供了整数索引而不是对象,无论您创建了什么自定义类

That actually gets you the integer index and not the object, regardless of what custom class you have created