Visual Basic Breaking Changes in Visual Studio 2012
The following table lists changes that might prevent an application that was created in Visual Basic 2010 from compiling in Visual Basic in Visual Studio 2012 and changes might change the run-time behavior of an application.
Category |
Issue |
Description |
---|---|---|
Type inference |
In a Return statement where the operand is an array literal, the runtime array type is determined from the function signature instead of being inferred from the array literal. |
This change lets you return an array literal in places where you couldn’t before, as the following example shows:
This change might result in the runtime type of an array literal being wider than what it was in Visual Basic 2010, as the following example shows:
|
Lambda expressions |
In a For Each expression, you can now use the control variable in a lambda expression. |
The use of a For Each iteration variable in a lambda expression no longer causes a compile-time warning and no longer has unexpected results, as the following example illustrates:
|
LINQ expressions |
In a For Each expression, you can now use the control variable in a LINQ expression. |
The use of a For Each iteration variable in a LINQ expression no longer causes a compile-time warning and no longer has unexpected results, as the following example illustrates:
|
Overload resolution |
If two overloads with generic type parameters match a caller equally well but one overload is more specific, the more specific overload is used. |
This condition caused an overload resolution compile-time error in Visual Studio 2010. In the following example, the Process(theList) line causes a compile-time error in Visual Studio 2010. In the current version, the line matches the more specific overload of the Process method.
|
See Also
Reference
For Each...Next Statement (Visual Basic)
Concepts
Lambda Expressions (Visual Basic)
What's New for Visual Basic in Visual Studio 2012