Avatar of Richard
Richard
Flag for United States of America

asked on 

What is wrong with this linq statement?

What is wrong with this linq statement?

private List<OnBoard> onboards = new List<OnBoard>(); 
public OnBoard obr; 
public Member member;
 
onboards = (List<OnBoard>)db.OnBoards.ToList(); 
var result = from obr in onboards where obr.MemberId == member.MemberId select obr;   

Open in new window

This compiles and executes with no errors, but obr is null after execution when onboards contains 500+ records and one does matches the requirements of the test (where obr.memberID == member.MemberID).  Right now there is only one record which matches.




LINQ QueryC#* c#,WPF, Linq

Avatar of undefined
Last Comment
Richard

8/22/2022 - Mon