……………………………………………….Expertise in .NET Technologies

  • Categories

  • Advertisements

What’s New in the Visual Basic Language 2.0?

Posted by Ravi Varma Thumati on October 2, 2009

Visual Basic 2005 introduces new language features, including loop continuation, guaranteed resource disposal, mixed access properties, unsigned and nullable data types, operator overloading, partial and generic types, custom events, and Common Language Specification (CLS) compliance checking.

This page lists features that are new to the Visual Basic language with Visual Basic 2005.

Continue Statement

Visual Basic now supplies a Continue statement, which immediately skips to the next iteration of a Do, For, or While loop.

Visual Basic 6.0 Form Access

Visual Basic now allows you to refer to a defined form, such as Form1, by using its class name, instead of explicitly creating an instance of it.

IsNot Operator

Visual Basic now furnishes an IsNot operator, with which you can avoid using the Not and Is operators in an awkward order..

Using Statement

Visual Basic now offers a Using…End Using block to ensure disposal of a system resource when your code leaves the block for any reason..

Explicit Zero Lower Bound on an Array

Visual Basic now permits an array declaration to specify the lower bound (0) of each dimension along with the upper bound.

Properties with Mixed Access Levels

Visual Basic now allows you to declare a property with different access levels on its Get and Set procedures.

Unsigned Types

Visual Basic now supports unsigned integer data types (UShort, UInteger, and ULong) as well as the signed type SByte.

Nullable Types

Visual Basic now supports extensions of value types that can take either their normal values or a null value. A null value is useful for indicating that a variable has no defined value because the information is not currently available.

Operator Overloading

Visual Basic now allows you to define a standard operator (such as +, &, Not, or Mod) on a class or structure you have defined.

Code Separation using Partial Types

Visual Basic now provides a mechanism to allow the integrated development environment (IDE) to separate generated code from your authored code into separate source files. Most of the time, you only have to deal with the code you wrote.

Generic Types

Visual Basic now supports type parameters on generic classes, structures, interfaces, procedures, and delegates. A corresponding type argument specifies at compilation time the data type of one of the elements in the generic type.

Custom Events

Visual Basic now allows you to have greater control over the detailed behavior of events. You can declare custom events by using the Custom keyword as a modifier for the Event statement. In a custom event, you specify exactly what happens when code adds or removes an event handler to or from the event, or when code raises the event. To maintain backward compatibility with existing code, the Custom keyword is not a reserved keyword.

Compiler Checking Options

Visual Basic 2005 introduces new compiler checking options. The /nowarn and /warnaserror (Visual Basic) options provide more control over how warnings are handled. Each one of these compiler options now takes a list of warning IDs as an optional parameter, to specify to which warnings the option applies.

  • CLS Compliance Checking

Visual Basic now generates a warning for each line of code that contains any specification or operation that the Common Language Specification (CLS) does not support.

  • Uninitialized Variable Checking

Visual Basic now generates a warning for each potentially uninitialized variable. A variable has this status if there is at least one possible execution path that does not assign any value to the variable before using it.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: