Wednesday, June 27, 2007

VB 9.0 Won't Support Collection Initializers (or Array Initializers!)

Paul Vick answered my Will Visual Basic 9.0 Have Collection Initializers? question in his June 27, 2007 What's in VB 2008? What's out? post. The answer, as I anticipated, is no. However, I was surprised to learn that VB 9.0 won't have array initializers, either. My limited tests indicated that array initializers were behaving as expected (i.e., like C# array initializers) in Beta 1. Paul says:

For VB 2008, we will only support initializing read-write fields of non-collection objects.

And explains the disappearance of array and collection initializers as follows:

Our original plans, going back to PDC05, included several more features for object initializers, such as being able to write to read-only properties, as well as collection and array initializers. In the end, the schedule for VS 2008 was not sufficient to implement these features with a high degree of confidence. Which unfortunately means that they will have to wait to a release beyond VS 2008.

Array and collection initializers deliver a major productivity boost, especially for unit testing where you don't want to hit the database because of greatly increased test times.

On the LINQ front, VB 9.0's lambda expressions won't support statement blocks, but that's been known for some time and probably isn't a major issue.

I was surprised to learn that the VB 9.0 compiler will deliver expression trees. Neither the September 2005 "Overview of Visual Basic 9.0" .doc file or the current HTML Overview of Visual Basic 9.0 version of February 2007 mentions expression trees, so I assumed

that support for writing them with VB was gone, too.

I doubt if you'll see many expression trees written in VB. Folks who write custom LINQ for Whatever implementations for specialized data domains are certain to do so with C# 3.0.

On the whole, I think most—if not all—developers who prefer writing VB code would rather have array and collection initializers than the capability to write expression trees.

Slightly off-topic: The more C# 3.0 LINQ code I write, the better I like C#'s "fat arrow" lambda (=>) operator (argument-list => expression-or-statement-block) rather than VB's forthcoming inline Function(argument-list) expression syntax.

3 comments:

Anonymous said...

You're correct that most people won't directly write expression trees, but the feature is definitely necessary to be able to query against LINQ to SQL databases. Without expression trees, you wouldn't be able to use LINQ to SQL at all, so that's why we've done it...

Unknown said...

I'm shocked badly by this post.
Starting to feel like in the old VB vs. VC++ days. Just when I thought VB.Net moves to the front line again...

Anonymous said...

qcsglll
车库门
卷帘门
伸缩门
翻译公司
道闸
挡车器
伸缩门
货架
货架
货架
货架
货架
电动伸缩门
车库门
自动车库门
防火卷帘门
阳光房
除湿机
抽湿机
比歘情



电动伸缩门
伸缩门
卷帘门
车库门
道闸
挡车器
岗亭
道闸
伸缩门
自动门
车库门
岗亭
日上
日上防盗门
电动伸缩门
卷帘门
伸缩门


自动车库门
车库门
伸缩门
自动门
电动门
伸缩门
卷帘门
车库门
电动伸缩门
道闸
岗亭
自动车库门
电动伸缩门
岗亭
卷帘门
车库门
伸缩门
电动门
自动门



卷帘门
电动门
自动门
卷帘门
道闸
车库门
伸缩门
岗亭
岗亭
岗亭
岗亭
岗亭
岗亭
车库门
道闸
卷帘门
防火卷帘门
电动伸缩门
道闸


防火卷帘门
自动车库门
车库门
伸缩门
电动伸缩门
挡车器
北京SEO
专业SEO
专业SEO
专业SEO
锅炉安装
Oracle数据库容灾复制
Oracle容灾备份
Oracle备份恢复
北京铁艺





bgwldwzjzzxh!!
妇科
六合彩
热门图库
热门图库精