473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

Is there a difference between datarow.length == 0 and datarow == null in
terms of performance?
Dec 18 '07 #1
4 5197
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: spammy | last post by:
hi all, my code currently reads as the following: ////// double tmpposition = (double)dr + pos; dr = tmpposition;
1
by: ad | last post by:
What is the difference between DataRow and DataRowView?
1
by: Shock | last post by:
Anybody ever tried to assign certain values in one datarow to certain locations in another datarow? Here is my code to this pont. Followed by the output from the command window in vs.net...
8
by: Niron kag | last post by:
Hi, I have a loop an in the loop I populate an array of dataRow. My problem is the array keeps its values from previous loop, and its Length gets bigger every loop. My code is: DataRow...
1
by: Ryan Liu | last post by:
Hi, When my code run to DataRow.Delete() It throws: System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: length at System.Array.Copy(Array sourceArray, Int32...
5
by: samoore33 | last post by:
I use the code below to search through a DataSet: Dim t As DataTable t = result.Tables("State") Dim strExpr As String strExpr = "id = '" & theState.ToString() & "'" Dim foundRows() As DataRow...
5
by: Rainer Queck | last post by:
Hello NG, what would be the best way to locate a DataRrow in a DataGridView? I have by DataTable.Select a bunch of DataRows from a DataTable (which is the data source to the DataGridView). Now...
1
by: Uli Netzer | last post by:
between Dim strXYZ() as String and Dim strXYZ as String() It doesn't seem to make a difference in the way I use the variable. Another problem I have. I load three variables with 3 values...
9
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.