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 Operator

Public 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.
Published Monday, October 27, 2003 8:34 PM by PaulWilson

Comments

# re: VB.NET v2.0: Operators, Using, Unsigned Types, and More

And for the record, IsFalse(obj) and IsTrue(obj) are both new operators for Whidbey.

Monday, October 27, 2003 9:35 PM by Brian Desmond

# re: VB.NET v2.0: Operators, Using, Unsigned Types, and More

So do we get multiple inherits as well

Monday, April 19, 2004 3:29 PM by bisa1

# re: VB.NET v2.0: Operators, Using, Unsigned Types, and More

No -- but neither does C#. Try Effiel for .NET if you need it.

Monday, April 19, 2004 5:16 PM by Paul Wilson

Leave a Comment

(required) 
(required) 
(optional)
(required)