Professional Documents
Culture Documents
Net Beta 2
The long-awaited VB.NET Beta 2 has been released at last, so this week's column is
devoted to a few of the many changes in syntax that this new version enforces. This isn't
a complete list, of course, and I am pretty sure I am leaving out something important, but
at least you can use this information to get familiar with the new beta in less time.
Beta 1 used these operators to implement bit-wise operations, whereas the old And, Or,
Xor, and Not, had become pure Boolean operators. After many complains from the VB
community, they decided to restore things as they work in VB6: And, Or, Xor, and Not
are again bit-wise operators, and the Bitxxx operators are gone.
In this case VB doesn't evaluate the term (y ^ x) if (x > 0) happens to be False, because
that wouldn't change the value of the expression. Similarly, in the following case
In Beta 1, the value passed to Dim and ReDim was the number of elements (as in C++
and C#), a detail that puzzled many die-hard VBers. In Beta 2 this value has the same
meaning as under VB6. Because all VB.NET arrays are zero-based, it means that the
array always has one more element than the number specified in the statement:
In Beta 1 you can check whether two object variables point to the same object instance
using the = operator; in Beta 2 and the final version you must use the Is operator (as you
do in VB6).
This namespace contained all the functions that have a VB6 name, and was meant to
assist VB developers in migrating their apps. In Beta 2 all these functions are in the less
verbose Microsoft.VisualBasic namespace. If you have written VB.NET code that uses
these functions, you should only modify the Imports statement.
In Beta 1, position of < > attributes preceded the _name_ of the item they refer to, which
led to a rather weird syntax, as in:
Fortunately, in Beta 2 and the final release, attributes will precede the item they refer to,
making for a more readable syntax that is similar to C#'s:
You can move the attribute to a line of its own for a syntax that resembles C# even more
closely:
This data type isn't supported any longer and you should use Decimal instead. The
Decimal type has a higher precision and larger valid range.
All classes inherit the ToString method from System.Object (the mother of all objects in
.NET), and usually override it so that it returns a textual representation of the object's
value. For all the objects in the .NET framework, ToString returns a local-aware value
now. For example, if the object has a numeric value, ToString will return the string
representation of such a value, but will use different symbols for the decimal separator: a
period in the US, a comma in most European countries.
This change affects the name of many objects in the framework. In Beta 1 the convention
for naming collection-like objects was to use the plural of the name (e.g. "Parameters",
"Properties", etc.). In Beta 2 the convention has changed, and now these objects have a
trailing "Collection" word (e.g. "ParameterCollection", "PropertyCollection"). You
should use a similar naming convention in your own object hierarchies.