Next versions of Visual Basic and C# each get new language features that are outlined in a post by S. Somasegar, Senior Vice President of Microsoft’s Developer Division. In a blog post, VB and C# enhancements in VS 2010, he details the coming features that make it easier to write your code.
The key enhancements to Visual Basic include:
- You no longer will need the underscore (“_”) character when breaking a code statement across multiple lines in most cases.
- Auto-implemented properties cuts the lines of code needed to write property declarations and their getters and setters.
- Collection initializers and array literals are simpler.
- Lambdas can now contain expressions that don’t return a value.
- Interoperating dynamic language code is now easier so you can call into Python and Ruby libraries.
C# 4.0’s major themes are interoperability with dynamic programming paradigms and improved Office programmability.
- Dynamic lookup, a new feature in C# 4.0, allows you to use and manipulate an object from IronPython, IronRuby, JScript, the HTML DOM, or a standard .NET library in the same way, no matter where it came from.
- Adding the new dynamic keyword to your code allows its type to be resolved dynamically at runtime rather than statically at compile-time.
- Optional parameters are declared with a default value in the method signature.
- Named arguments are also a great way to write self-documenting calls to your existing methods, even if they don’t use optional parameters.
For more information and code samples, see VB and C# enhancements in VS 2010.
Bruce D. Kyle
ISV Architect Evangelist | Microsoft Corporation