linq查询找不到特定列表中的对象索引 [英] linq query does not find the index of object from a particular list

查看:66
本文介绍了linq查询找不到特定列表中的对象索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个学生类型列表。我想从学生列表中针对studentID搜索目标学生。我的代码片段如下:

I have a list of student type.I want to search intended student from the student list against studentID. My code snippet is given below

int index = StudentList.FindIndex(x => x.studentID == studId);

int index = StudentList.FindIndex(x => x.studentID == studId);

执行后Linq查询,我在学生列表中有200条记录,当它在studentList上应用搜索条件时,它会返回我意想不到的结果 

After execution of Linq Query ,I have 200 records in the student list when it applying the searching criteria on studentList it returns me unexpected results 

推荐答案

您能否提供预期和实际结果?
Can you please proivde the expected and actual result?


这篇关于linq查询找不到特定列表中的对象索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆