By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,087 Members | 963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,087 IT Pros & Developers. It's quick & easy.

Is there a difference between datarow.length == 0 and datarow == n

P: n/a
Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?
Dec 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Well, I would expect the datarow == null to be more performant, as it is
less operations. The former comparison has to make the call to the
property/field, and then perform the comparison whereas the latter is just
checking the reference to see if it is null.

However, this is comparing apples to oranges, since you are not making
to comparisons that have the same semantics, so the previous point is pretty
moot.

Also, I think this could easily be considered a severe case of
micro-optimization.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"lianqtlit" <li*******@discussions.microsoft.comwrote in message
news:D6**********************************@microsof t.com...
Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?
Dec 18 '07 #2

P: n/a
Thanks

"Nicholas Paldino [.NET/C# MVP]" wrote:
Well, I would expect the datarow == null to be more performant, as it is
less operations. The former comparison has to make the call to the
property/field, and then perform the comparison whereas the latter is just
checking the reference to see if it is null.

However, this is comparing apples to oranges, since you are not making
to comparisons that have the same semantics, so the previous point is pretty
moot.

Also, I think this could easily be considered a severe case of
micro-optimization.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"lianqtlit" <li*******@discussions.microsoft.comwrote in message
news:D6**********************************@microsof t.com...
Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?
Dec 18 '07 #3

P: n/a
lianqtlit wrote:
Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?
If datarow does indeed == null, then would not attempting to access
datarow.length throw an exception?

-rick-
Dec 18 '07 #4

P: n/a
yah!! your right thanks... rick

"Rick Lones" wrote:
lianqtlit wrote:
Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?

If datarow does indeed == null, then would not attempting to access
datarow.length throw an exception?

-rick-
Dec 18 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.