VBNullString
Don McNamara points out this:
VB.NET
(nothing = String.Empty) is true
C#
(null == String.Empty) is false
Looks like another "mort feature"... that is what VBNullString is for :-). On the one hand, you can argue that it makes you more productive, because you can automatically test for both empty and null at the same time. On the other hand, it just doesn't feel right to have a special case null value. For instance, consider the following code:
foreach(object o in objects)
{
if(o == null) { /* do something */ }
}
Anyone know how you would do this in VB.NET?
Update: I figured it out:
for (i = 0 to objects.Count)
if(IsNothing(objects.Item(i))) then
'do something
end if
next
but, if you do:
for (i = 0 to objects.Count)
if(objects.Item(i) = Nothing) then
'do something
end if
next
Then you will get different results. Doesn't make too much sense in my mind...but that is why I code in a different language :-).