Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • 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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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