What's New in the Visual Basic Language
Updated: July 2008
Visual Basic 2008 introduces new language features, including local type inference, object initializers, anonymous types, and extension methods. These features serve as support for an important new feature, Language-Integrated Query (LINQ), but they are also useful individually.
This topic introduces the new features and provides links to additional information about them.
In this topic, you can find more information about queries, including information about these keywords:
You can now include XML as first-class data types in your Visual Basic code, making it fast and easy to create, transform, modify, and query XML.
By using local type inference (also referred to as implicit typing), the compiler determines the data types of local variables based on the values that are used to initialize them.
By using object initializers, you can initialize a complex data object in an expression, without an explicit call to a constructor.
The anonymous types feature enables you to create instances of a new data type without first writing the definition of the class. Instead, the compiler creates the data type definition based on the properties you specify when you declare the instance.
Extension methods enable you to add methods to a data type from outside the type. The methods can be invoked as if they were ordinary instance methods of the data type
A lambda expression is a function without a name that can be used wherever a delegate type is valid.
The If operator uses short-circuit evaluation to conditionally return one of two values. It can be called with three arguments or with two arguments.
Partial methods enable developers to insert custom logic into code. A partial method is defined in a partial class, and any developer who uses the class can specify the desired behavior for the method.
You can add a ? modifier to a type name or a variable to specify the nullable version of the type. A nullable value type can have the value Nothing in addition to the values of the non-nullable version of the type.