Visual Basic 2005在语言上的增强(十三)显式的数组范围及小结
2024-07-21 02:22:53
供稿:网友
显式的数组范围
你现在可以使用显式的数组范围来声明数组,这样的声明更加清晰可读了:
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.