Solved

What does IQueryable with no records return to C# program

Posted on 2011-09-22
4
222 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
Comment Utility
0
 
LVL 4

Accepted Solution

by:
g_johnson earned 0 total points
Comment Utility
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
Comment Utility
This turns out to be the correct answer.
0
 
LVL 4

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

17 Experts available now in Live!

Get 1:1 Help Now