Drivers Category

Drivers Update
Drivers

Net check for null object list

Version: 47.76.46
Date: 10 March 2016
Filesize: 0.546 MB
Operating system: Windows XP, Visa, Windows 7,8,10 (32 & 64 bits)

Download Now

They usually have the same effect, although they compile to different things. if (my Object = null) results in a ceq opcode, which I'd expect to compile to quicker code. object. Reference Equals is a method call like any other. They're different when my Object has an operator= method; when this is present, your code calls into this method instead of using ceq. operator= can then do whatever it likes. Always if (my Object = null) unless you have a reason not to.
As others have already pointed out, it's not data but rather likely data List that is null. In addition to that. catch-throw is an antipattern that almost always makes me want to throw up every time that I see it. Imagine that something goes wrong deep in something that do Other Stuff calls. All you get back is an Exception object, thrown at the throw in Add Data. No stack trace, no call information, no state, nothing at all to indicate the real source of the problem, unless you go in and switch your debugger to break on exception thrown rather than exception unhandled. If you are catching an exception and just re-throwing it in any way, particularly if the code in the try block is in any way nontrivial, do yourself (and your colleagues, present and future) a favor and throw out the entire try-catch block. Granted, throw; is better than the alternatives, but you are still giving yourself (or whoever else is trying to fix a bug in the code) completely unnecessary headaches. This is not to say that try-catch-throw is necessarily evil per se, as long as you do something relevant with the exception object that was thrown inside the catch block. Then there's the potential problems of catching Exception in the first place, but that's another matter, particularly since in this particular case you throw an exception. Another thing that strikes me as more than a little dangerous is that data could potentially change value during the execution of the function, since you are passing by reference. So the null check might pass but before the code gets to doing anything with the value, it's changed - perhaps to null. I'm not positive if this is a concern or not (it might not be but it seems worth watching out for.

© 2011-2016 piddbullcatchga.5v.pl