[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结
[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结,[译]Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结
你现在可以使用显式的数组范围来声明数组,这样的声明更加清晰可读了:
Dim a(10) As Integer '旧方式
Dim b(0 To 10) As Integer '新方式
Visual Basic中的数组范围仍然是以零为起始,所以如果你想声明一个不是以零为起始范围的数组,你就会得到一个编译器错误。
小结
Visual Basic 2005语言获得了一些重要的特性以及诸多细微的增强,这些都极大地提高了它的易用性和开发人员的生产效率。这个语言变得更加完善,并且和C#的不少主要特性也更好地对应起来,诸如XML注释和操作符重载。
把IDE上不胜枚举的增强功能考虑进去,Visual Basic 2005将会是Visual Basic所有的已发行版本中最强大的一款。不但从语言特性方面得到了增强,而且使用它简直充满了纯粹的乐趣。现在唯一令我遗憾的是我还无法使用Visual Basic 2005创建生产应用程序。你也来试爽一下Beta版吧,我想你会同意我的观点的。
译后记
译完了Stan Schultes先生的《Language Enhancements in Visual Basic 2005》系列文章,觉得总算做完了一件挺大的事情。在这里涕淌要感谢所有来涕淌居阅读这些文章并提出各种尖锐意见的网友们,谢谢你们!唉~~~无论多么华丽的辞藻都无法表达涕淌对Visual Basic的爱意。2005年到来了,让我们一起祝福她吧!
@以下是原文供网友们参考@
Explicit Array Bounds
You can now declare arrays using explicit array bounds to make the declaration clearer:
Dim a(10) As Integer 'old way
Dim b(0 To 10) As Integer 'new way
Array bounds in Visual Basic are still zero-based, so you'll get a compiler error if the array lower bounds value isn't 0.
Conclusion
The Visual Basic 2005 language gains several major features and many smaller enhancements that together provide significant increases in ease of use and developer productivity. The language has become more complete, and there is more parity with C# on major features like XML comments and operator overloading.
Coupled with a myriad of IDE enhancements, Visual Basic 2005 is poised to be the best version of Visual Basic ever released. Not only better from a language feature standpoint, but it's also a sheer joy to use. I'm disappointed only because I can't build production applications with the Visual Basic 2005 today. Give the Beta version a try, and I think you'll agree.