VB.NET v2.0: Operators, Using, Unsigned Types, and More
It seems I've “outed” several new VB.NET keywords so far today, so I might as well continue with that theme.
- Continue -- This one's obvious, but from Whidbey's MSDN: Transfers control immediately to the next iteration of a loop.
- Operator -- VB finally gets operator overloading, with plenty of binary and unary operators to redefine. Whidbey's MSDN:
Public Shared Operator Or(ByVal x As abc, ByVal y As abc) As abc
Dim r As New abc
Return r
End OperatorPublic Shared Operator IsFalse(ByVal z As abc) As Boolean
Dim b As Boolean
Return b
End Operator
- Using -- Equivalent to the using keyword in C# that automatically calls the Dispose method when done. My example:
Using _myClass As New MyClass()
_myClass.MyMethod()
End Using
- Expands -- See this post on Code-Beside for some discussion of Partial Types, where Expands is the VB keyword.
- Of -- See this post on generics support in VB.NET, where Of is the VB keyword that is equivalent to <> syntax in C#.
- SByte, UInteger, ULong, and UShort -- These should be obvious, each one is unsigned type, except signed SByte.
- IsFalse, IsNot, IsTrue -- These are new operators that can be overridden with the new operator overloading above.