C# if statement. inner workings Q
Posted
by Mike Mengell
on Stack Overflow
See other posts from Stack Overflow
or by Mike Mengell
Published on 2010-05-27T14:19:13Z
Indexed on
2010/05/27
14:21 UTC
Read the original article
Hit count: 264
c#
I've just come across this code snippet in some Exchange 2010 code and I was wondering if anyone knew why the programmer has done it this way. I've never seen an If statement formatted like this. It seems so backwards there must be a good reason for it??
if (true == MsgItem.HasAttachments)
{
// Code
}
I'm assuming it might have some optimisation over the various other ways of coding the same thing;
if (MsgItem.HasAttachments)
{
// Code
}
or
if (MsgItem.HasAttachments == true)
{
// Code
}
Its not a big deal I'm just curious.
Thanks, Mike
© Stack Overflow or respective owner