Click here to Skip to main content
Click here to Skip to main content

Sequence contains no elements

By , 14 Jan 2010
Rate this:
Please Sign up or sign in to vote.
The error occurs when you try to access an object returned by a Linq query with 0 elements in the result set an InvalidOperationException is thrown. here is a simulation to generate the error and fix it: LINQ: Sequence contains no elements[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ali Tarhini
Software Developer (Senior) Microgen
Lebanon Lebanon
For more articles and extreme topics please check out my personal website www.alitarhini.com

Comments and Discussions

 
QuestionStatus of hyperlink Pinmemberjoshrduncan201221-Nov-13 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 14 Jan 2010
Article Copyright 2010 by Ali Tarhini
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid