Click here to Skip to main content
15,887,417 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating a 2 Dimension List<string> Pin
Luc Pattyn3-Jul-09 4:30
sitebuilderLuc Pattyn3-Jul-09 4:30 
AnswerRe: Creating a 2 Dimension List<string> Pin
Luc Pattyn2-Jul-09 16:37
sitebuilderLuc Pattyn2-Jul-09 16:37 
QuestionCreating batch file to install/uninstall C# app Pin
steve_rm2-Jul-09 15:11
steve_rm2-Jul-09 15:11 
AnswerRe: Creating batch file to install/uninstall C# app Pin
Arindam Sinha2-Jul-09 23:54
Arindam Sinha2-Jul-09 23:54 
QuestionIf (null == something) or if (something == null) Pin
_Maxxx_2-Jul-09 13:38
professional_Maxxx_2-Jul-09 13:38 
AnswerRe: If (null == something) or if (something == null) [modified] PinPopular
Luc Pattyn2-Jul-09 13:52
sitebuilderLuc Pattyn2-Jul-09 13:52 
AnswerRe: If (null == something) or if (something == null) Pin
Dave Doknjas2-Jul-09 14:15
Dave Doknjas2-Jul-09 14:15 
AnswerRe: If (null == something) or if (something == null) Pin
Thomas Weller2-Jul-09 14:18
Thomas Weller2-Jul-09 14:18 
_Maxxx_ wrote:
is there a good reason for using the former over the latter?


There is, and AFAIK this reason comes from the good old C/C++ days. It was a very common error (the most common of all) to type if (reason = null) instead of if (reason == null). This small little typo led to very strange program behaviour and was very hard to debug, because it's very easy to overread it when inspecting the code. The problem was that the C/C++ - Compiler didn't even issue a warning when you typed something like if (reason = null), but it immediately complained about if (null = reason).

So it's all about correctness and maintainability. I even saw companies with coding guidelines that dictated this style.

Regards
Thomas

www.thomas-weller.de

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.


AnswerRe: If (null == something) or if (something == null) Pin
PIEBALDconsult2-Jul-09 15:11
mvePIEBALDconsult2-Jul-09 15:11 
AnswerRe: If (null == something) or if (something == null) Pin
_Maxxx_2-Jul-09 18:03
professional_Maxxx_2-Jul-09 18:03 
GeneralRe: If (null == something) or if (something == null) Pin
Moim Hossain2-Jul-09 22:08
Moim Hossain2-Jul-09 22:08 
GeneralRe: If (null == something) or if (something == null) Pin
moon_stick3-Jul-09 1:03
moon_stick3-Jul-09 1:03 
GeneralRe: If (null == something) or if (something == null) Pin
PIEBALDconsult3-Jul-09 8:27
mvePIEBALDconsult3-Jul-09 8:27 
AnswerRe: If (null == something) or if (something == null) Pin
btough2-Jul-09 22:08
btough2-Jul-09 22:08 
QuestionDrawing a smooth line graph Pin
Rsesky0002-Jul-09 12:44
Rsesky0002-Jul-09 12:44 
AnswerRe: Drawing a smooth line graph Pin
Luc Pattyn2-Jul-09 12:58
sitebuilderLuc Pattyn2-Jul-09 12:58 
GeneralRe: Drawing a smooth line graph Pin
Rsesky0002-Jul-09 13:49
Rsesky0002-Jul-09 13:49 
GeneralRe: Drawing a smooth line graph [modified] Pin
Luc Pattyn2-Jul-09 13:54
sitebuilderLuc Pattyn2-Jul-09 13:54 
GeneralRe: Drawing a smooth line graph Pin
Rsesky0002-Jul-09 14:27
Rsesky0002-Jul-09 14:27 
QuestionBitmap Pixels in Bulk Pin
hpydir2-Jul-09 11:37
hpydir2-Jul-09 11:37 
AnswerRe: Bitmap Pixels in Bulk Pin
harold aptroot2-Jul-09 11:41
harold aptroot2-Jul-09 11:41 
AnswerRe: Bitmap Pixels in Bulk Pin
Svetlin Panayotov2-Jul-09 11:43
Svetlin Panayotov2-Jul-09 11:43 
GeneralRe: Bitmap Pixels in Bulk Pin
hpydir2-Jul-09 11:50
hpydir2-Jul-09 11:50 
QuestionGrouping data in tabs Pin
spankyleo1232-Jul-09 11:35
spankyleo1232-Jul-09 11:35 
QuestionRe: Grouping data in tabs Pin
harold aptroot2-Jul-09 11:52
harold aptroot2-Jul-09 11:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.