Solved

What does IQueryable with no records return to C# program

Posted on 2011-09-22
4
223 Views
Last Modified: 2012-06-22
In the attached code, if there are no records, will "x" be null?  If not, what will it be?

Thanks.

var x = from i in dc.table where i.field == "xyz" select i;

Open in new window

0
Comment
Question by:g_johnson
  • 3
4 Comments
 
LVL 3

Expert Comment

by:russellC
ID: 36581469
0
 
LVL 4

Accepted Solution

by:
g_johnson earned 0 total points
ID: 36581808
Actually what I found out by testing was that it returns an empty collection, i.e., x.Count() = 0.

Thanks for taking a look
0
 
LVL 4

Author Closing Comment

by:g_johnson
ID: 36708107
This turns out to be the correct answer.
0
 
LVL 4

Author Comment

by:g_johnson
ID: 36581818
Testing proves out that x is not null when the statement is executed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Round up to 100% in .NET 10 79
Long URL in SMS 6 31
Parallel.ForEach using SendMailAsync() detect when loop is complete 24 52
Definitions and default visual studio colors 5 58
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now