我有这个片段。列表lambda表达式抛出一个特定查询的InvalidOperationException
List<Frames> FrameList;
其中,框架是只包含包括字符串字段“ExerciseID”的基元的类。
...
void GetFramesForExercise(string exerciseID)
....
if (exerciseID == "3.2.2") {
Console.Write(""); } // quick and dirty to add a breakpoint
if (FramesList[115].ExerciseID.Equals(exerciseID)) {
Console.Write(""); } // quick and dirty to add a breakpoint
frames = (Frames)FramesList.Single(r => r.ExerciseID.Equals(exerciseID));
通过把断点在console.write声明,我能看到exerciseID确实等于“3.2.2”和FramesList [115]点锻炼,ID为实例“3.2 .2" 。指出的实例正确启动。
为什么我的查询抛出InvalidOperationException?
请张贴满异常消息 – empi
应该没有必要投自'名单返回值''Frames'是强类型... –
khellang
什么的frameList和FramesList之间的区别 - 错字:) – Simon