|
Quote: Is this inside a single method?
Yes, it is.
Quote: I'd be more concerned here with the fact you'd never fill the employees list.
How??
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
Never mind - I've been up for the last 16 hours. I was reading != as == here for some reason.
|
|
|
|
|
Ohh, that's okay...
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
Pete O'Hanlon wrote: I was reading != as == here Thanks for the explanation, for a normally sensible person, I was wondering what you were smoking or what I missed with your prior comment too.
|
|
|
|
|
It isn't really filling the list, it's replacing the reference with the result of that method call. I don't think that's what he meant though. A bit pedantic, I'm sorry.
|
|
|
|
|
I think the point was that
List<Employee> employees = GetEmployees();
could just as well have been used to create a null or non-null employees object because the if statement would never be false for a statement that could produce a null result. In fact you might want to execute
if (employees == null) throw...
after executing the above line because now you are in a situation where the if statement could be true or false even if the current coding of the routine would never return null. (speaking of being pedantic...)
|
|
|
|
|
Keeping the runtime on its toes.
|
|
|
|
|
True...
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
I hope there's a unit test for that too.
|
|
|
|
|
More like the garbage collector...
|
|
|
|
|
That's a real conundrum for the GC -
"OK, if this object is still around, at this point, I can't GC it until then. But... but what if I ... secretlly GC it before the if?"
|
|
|
|
|
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
Guess he don't believe the guys at microsoft!
|
|
|
|
|
Then, he must be a Genius
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
Hm. and why even initialize the variable if you're going to assign another value anyway?
|
|
|
|
|
Thanks.
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
And what is the " = new List<employee>()" doing there, either? Assign it one value, then if it isn't null, which it can't be, immediately assign it another value and discard the first object? Goofy.
|
|
|
|
|
Thanks for raising this point.
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
|
|
Do you two realize how much money you just cost CP with this waste of disk space? You better click on some ads to pay for your mistakes.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
What was that message??, now its not there
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
Weird, I wonder why they were removed. They just had a ton of smiley face icons.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
May be because of "Smiley Overflows"
Previous -> Read "CLR via C#" by Jeffrey Ritcher.
Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder.
Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.
|
|
|
|
|
You owe me for the bandwidth cost of 2396 unnecessary s! Only the icon has 831 bytes, which amounts to a total of 1,991,076 wasted bytes. Gotta count now the extra html chars and send you the invoice!
|
|
|
|