posted on Friday, February 01, 2008 9:50 PM |

Visual Basic was a good thing back in the day.  But it is seriously ugly.  AndAlso?  OrElse?  So much extra for so little gain.

VB:

If (String.IsNullOrEmpty(item.ImageUrl) _
    AndAlso ((item.Variants.Length = 0) OrElse Not HasFiles(item.Variants))) Then
        FileNotFound.Visible = True

c#:

if (string.IsNullOrEmpty(item.ImageUrl) && 
    (item.Variants.Length == 0 || !HasFiles(item.Variants)))
        FileNotFound.Visible = true;

AndAlso? OrElse? So much extra for so little gain.  Yes, I know if I gave it to my mom, she could read the top line but not the bottom.  With 1 minute of talking, she could understand ! is not, || is or, and && is and.

And don't even get me started on the white space.

Tags [ Coding Video ]

Your Comments.

No comments posted yet.

Post Comment
Title *
Name *
Email
Url
Comment *  
Please add 2 and 8 and type the answer here: