In my ASP.NET MVC 2 C# web app I have a repository that contains method that returns an Iqueryable. My controller calls this, handing over some variables to it so it an run a linq to sql query. How can I check to see if the returning iqueryable has returned anything/contains anything to the controller? Basiclly check if it is returns null?
For the life of me i can't figure it out and it is frustrating because I am guessing that is straig开发者_StackOverflow中文版htforward to do!!
Thanks,
var query = db.Foos.Where( ... );
if (query.Any())
{
... we got something ...
}
精彩评论