How can I return an empty IEnumerable?

Hy guys!

My app is doing a query like this:

        public Order GetOrderByPerson(Order order, Person person)
             return Repository.All()
                .Where( x => x.Order == order )
                .Where( y => y.envolvedPerson == person )

And when there is no elements, it returns an error:

Sequence contains no elements

Is ok to return null, how can I prevent this error?




return Repository.All()
                .Where( x => x.Order == order )
                .Where( y => y.envolvedPerson == person )

and check if its null in the calling method

Need Your Help

Status report during form process

php xml forms post import

I created a little script that imports wordpress posts from an xml file:

Why does VS throw an error when compiling an uninitialized string used in a strcpy function?

c string pointers struct strcpy

I was curious to know why the following code snippet works in some C compilers and not others. My professor can compile this code in DevC++ and so can I, but I can not compile this code in VS 2010....

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.