C
C#3y ago
Tayseer

debugging issue

Hello folks, I have a problem I hope I can explain what's happening. When I have break points on certain blocks of code the desired select statement that selects SingleOrDefault works fine. Without breakpoints (on normal debuging) the list has more than one item then an exception fires and says "sequence contains more than one element".
3 Replies
Aaron
Aaron3y ago
FirstOrDefault is the version you use if more than 1 item being in the list is acceptable SingleOrDefault is used if you want there to always be 0 or 1 items
Tayseer
TayseerOP3y ago
The thing I I have to use SingleOrDefault and it's working fine when there is breakpoint Otherwise it doesn't
Brady Kelly
Brady Kelly3y ago
It might be that with the breakpoint only one item has been added to the list when SingleOrDefault is called and without the breakpoint more items get added to the list
Want results from more Discord servers?
Add your server