• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

What does IQueryable with no records return to C# program

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
g_johnson
Asked:
g_johnson
  • 3
1 Solution
 
g_johnsonAuthor Commented:
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
 
g_johnsonAuthor Commented:
This turns out to be the correct answer.
0
 
g_johnsonAuthor Commented:
Testing proves out that x is not null when the statement is executed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now