Solved

What does IQueryable with no records return to C# program

Posted on 2011-09-22
4
226 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How would you add MULTITHREADING to the attached C# code? 4 63
Video Player 11 23
Simple Injector with Web Service 4 42
C# Desktop Application 3 35
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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 …

803 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